-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathpostgres_scanner.hpp
105 lines (84 loc) · 2.45 KB
/
postgres_scanner.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//===----------------------------------------------------------------------===//
// DuckDB
//
// postgres_scanner.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb.hpp"
#include "postgres_utils.hpp"
#include "postgres_connection.hpp"
#include "storage/postgres_connection_pool.hpp"
namespace duckdb {
class PostgresCatalog;
struct PostgresLocalState;
struct PostgresGlobalState;
class PostgresTransaction;
struct PostgresBindData : public FunctionData {
static constexpr const idx_t DEFAULT_PAGES_PER_TASK = 1000;
PostgresVersion version;
string schema_name;
string table_name;
string sql;
string limit;
idx_t pages_approx = 0;
vector<PostgresType> postgres_types;
vector<string> names;
vector<LogicalType> types;
idx_t pages_per_task = DEFAULT_PAGES_PER_TASK;
string dsn;
bool requires_materialization = true;
bool can_use_main_thread = true;
bool read_only = true;
bool emit_ctid = false;
idx_t max_threads = 1;
public:
void SetTablePages(idx_t approx_num_pages);
void SetCatalog(PostgresCatalog &catalog);
void SetTable(PostgresTableEntry &table);
optional_ptr<PostgresCatalog> GetCatalog() const {
return pg_catalog;
}
optional_ptr<PostgresTableEntry> GetTable() const {
return pg_table;
}
unique_ptr<FunctionData> Copy() const override {
throw NotImplementedException("");
}
bool Equals(const FunctionData &other_p) const override {
return false;
}
private:
optional_ptr<PostgresCatalog> pg_catalog;
optional_ptr<PostgresTableEntry> pg_table;
};
class PostgresAttachFunction : public TableFunction {
public:
PostgresAttachFunction();
};
class PostgresScanFunction : public TableFunction {
public:
PostgresScanFunction();
static void PrepareBind(PostgresVersion version, ClientContext &context, PostgresBindData &bind,
idx_t approx_num_pages);
};
class PostgresScanFunctionFilterPushdown : public TableFunction {
public:
PostgresScanFunctionFilterPushdown();
};
class PostgresClearCacheFunction : public TableFunction {
public:
PostgresClearCacheFunction();
static void ClearCacheOnSetting(ClientContext &context, SetScope scope, Value ¶meter);
static void ClearPostgresCaches(ClientContext &context);
};
class PostgresQueryFunction : public TableFunction {
public:
PostgresQueryFunction();
};
class PostgresExecuteFunction : public TableFunction {
public:
PostgresExecuteFunction();
};
} // namespace duckdb