-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathpostgres_table_set.hpp
61 lines (47 loc) · 2.46 KB
/
postgres_table_set.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
//===----------------------------------------------------------------------===//
// DuckDB
//
// storage/postgres_table_set.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "storage/postgres_catalog_set.hpp"
#include "storage/postgres_table_entry.hpp"
namespace duckdb {
struct CreateTableInfo;
class PostgresConnection;
class PostgresResult;
class PostgresSchemaEntry;
class PostgresTableSet : public PostgresInSchemaSet {
public:
explicit PostgresTableSet(PostgresSchemaEntry &schema, unique_ptr<PostgresResultSlice> tables = nullptr);
public:
optional_ptr<CatalogEntry> CreateTable(ClientContext &context, BoundCreateTableInfo &info);
static unique_ptr<PostgresCreateInfo> GetTableInfo(PostgresTransaction &transaction, PostgresSchemaEntry &schema,
const string &table_name);
static unique_ptr<PostgresCreateInfo> GetTableInfo(PostgresConnection &connection, const string &schema_name,
const string &table_name);
optional_ptr<CatalogEntry> ReloadEntry(ClientContext &context, const string &table_name) override;
void AlterTable(ClientContext &context, AlterTableInfo &info);
static string GetInitializeQuery(const string &schema = string(), const string &table = string());
protected:
void LoadEntries(ClientContext &context) override;
bool SupportReload() const override {
return true;
}
void AlterTable(ClientContext &context, RenameTableInfo &info);
void AlterTable(ClientContext &context, RenameColumnInfo &info);
void AlterTable(ClientContext &context, AddColumnInfo &info);
void AlterTable(ClientContext &context, RemoveColumnInfo &info);
static void AddColumn(optional_ptr<PostgresTransaction> transaction, optional_ptr<PostgresSchemaEntry> schema,
PostgresResult &result, idx_t row, PostgresCreateInfo &pg_create_info);
static void AddConstraint(PostgresResult &result, idx_t row, PostgresTableInfo &table_info);
static void AddColumnOrConstraint(optional_ptr<PostgresTransaction> transaction,
optional_ptr<PostgresSchemaEntry> schema, PostgresResult &result, idx_t row,
PostgresCreateInfo &table_info);
void CreateEntries(PostgresTransaction &transaction, PostgresResult &result, idx_t start, idx_t end);
protected:
unique_ptr<PostgresResultSlice> table_result;
};
} // namespace duckdb