duckdb 0.7.2-dev2430.0 → 0.7.2-dev2552.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/connection.cpp +1 -1
- package/src/duckdb/extension/icu/icu-dateadd.cpp +3 -3
- package/src/duckdb/extension/icu/icu-datepart.cpp +3 -3
- package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +3 -3
- package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +4 -4
- package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-timebucket.cpp +1 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +4 -4
- package/src/duckdb/extension/json/json-extension.cpp +6 -6
- package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -8
- package/src/duckdb/src/catalog/catalog.cpp +166 -127
- package/src/duckdb/src/catalog/catalog_entry/copy_function_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +90 -82
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +65 -67
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +8 -8
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +10 -10
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +9 -9
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +5 -5
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +23 -23
- package/src/duckdb/src/catalog/catalog_entry.cpp +27 -6
- package/src/duckdb/src/catalog/catalog_search_path.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +84 -87
- package/src/duckdb/src/catalog/catalog_transaction.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_types.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
- package/src/duckdb/src/catalog/dependency_list.cpp +2 -2
- package/src/duckdb/src/catalog/dependency_manager.cpp +9 -10
- package/src/duckdb/src/catalog/duck_catalog.cpp +30 -26
- package/src/duckdb/src/catalog/similar_catalog_entry.cpp +1 -1
- package/src/duckdb/src/common/types.cpp +15 -27
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +4 -3
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +19 -18
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +5 -5
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +6 -5
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +4 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +4 -3
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +1 -1
- package/src/duckdb/src/function/built_in_functions.cpp +10 -10
- package/src/duckdb/src/function/function_binder.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +5 -6
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -2
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +9 -8
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +6 -6
- package/src/duckdb/src/function/table/arrow.cpp +32 -31
- package/src/duckdb/src/function/table/arrow_conversion.cpp +75 -59
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +8 -7
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +14 -14
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +26 -25
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +13 -12
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +7 -7
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +8 -9
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -9
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +13 -13
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +11 -10
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +5 -5
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +3 -3
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +2 -2
- package/src/duckdb/src/function/table/table_scan.cpp +39 -37
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/udf_function.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +122 -81
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +2 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/collate_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +24 -20
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +22 -17
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +28 -7
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +20 -19
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -9
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +10 -4
- package/src/duckdb/src/include/duckdb/common/enums/on_entry_not_found.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/types.hpp +3 -4
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +5 -4
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +28 -15
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +7 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +5 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +13 -0
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +4 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +12 -0
- package/src/duckdb/src/main/attached_database.cpp +12 -6
- package/src/duckdb/src/main/capi/table_function-c.cpp +17 -16
- package/src/duckdb/src/main/client_context.cpp +12 -11
- package/src/duckdb/src/main/database_manager.cpp +13 -12
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -2
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +9 -9
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +5 -1
- package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +26 -27
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +17 -17
- package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +9 -9
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +21 -21
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +2 -3
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +33 -36
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +5 -5
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +4 -4
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +7 -7
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +14 -13
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +36 -35
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +5 -4
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +3 -3
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +10 -12
- package/src/duckdb/src/planner/binder.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_expression.cpp +11 -2
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +2 -5
- package/src/duckdb/src/planner/operator/logical_create.cpp +2 -1
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_delete.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +2 -7
- package/src/duckdb/src/planner/operator/logical_update.cpp +2 -6
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +2 -2
- package/src/duckdb/src/planner/pragma_handler.cpp +3 -4
- package/src/duckdb/src/storage/checkpoint_manager.cpp +46 -46
- package/src/duckdb/src/storage/data_table.cpp +3 -6
- package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +28 -30
- package/src/duckdb/src/storage/write_ahead_log.cpp +8 -8
- package/src/duckdb/src/transaction/cleanup_state.cpp +1 -1
- package/src/duckdb/src/transaction/commit_state.cpp +3 -4
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
@@ -15,7 +15,7 @@ namespace duckdb {
|
|
15
15
|
//! A schema in the catalog
|
16
16
|
class DuckSchemaEntry : public SchemaCatalogEntry {
|
17
17
|
public:
|
18
|
-
DuckSchemaEntry(Catalog
|
18
|
+
DuckSchemaEntry(Catalog &catalog, string name, bool is_internal);
|
19
19
|
|
20
20
|
private:
|
21
21
|
//! The catalog set holding the tables
|
@@ -38,26 +38,30 @@ private:
|
|
38
38
|
CatalogSet types;
|
39
39
|
|
40
40
|
public:
|
41
|
-
CatalogEntry
|
42
|
-
|
43
|
-
CatalogEntry
|
44
|
-
|
41
|
+
optional_ptr<CatalogEntry> AddEntry(CatalogTransaction transaction, unique_ptr<StandardEntry> entry,
|
42
|
+
OnCreateConflict on_conflict);
|
43
|
+
optional_ptr<CatalogEntry> AddEntryInternal(CatalogTransaction transaction, unique_ptr<StandardEntry> entry,
|
44
|
+
OnCreateConflict on_conflict, DependencyList dependencies);
|
45
45
|
|
46
|
-
CatalogEntry
|
47
|
-
CatalogEntry
|
48
|
-
CatalogEntry
|
49
|
-
|
50
|
-
CatalogEntry
|
51
|
-
CatalogEntry
|
52
|
-
CatalogEntry
|
53
|
-
|
54
|
-
CatalogEntry
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
optional_ptr<CatalogEntry> CreateTable(CatalogTransaction transaction, BoundCreateTableInfo &info) override;
|
47
|
+
optional_ptr<CatalogEntry> CreateFunction(CatalogTransaction transaction, CreateFunctionInfo &info) override;
|
48
|
+
optional_ptr<CatalogEntry> CreateIndex(ClientContext &context, CreateIndexInfo &info,
|
49
|
+
TableCatalogEntry &table) override;
|
50
|
+
optional_ptr<CatalogEntry> CreateView(CatalogTransaction transaction, CreateViewInfo &info) override;
|
51
|
+
optional_ptr<CatalogEntry> CreateSequence(CatalogTransaction transaction, CreateSequenceInfo &info) override;
|
52
|
+
optional_ptr<CatalogEntry> CreateTableFunction(CatalogTransaction transaction,
|
53
|
+
CreateTableFunctionInfo &info) override;
|
54
|
+
optional_ptr<CatalogEntry> CreateCopyFunction(CatalogTransaction transaction,
|
55
|
+
CreateCopyFunctionInfo &info) override;
|
56
|
+
optional_ptr<CatalogEntry> CreatePragmaFunction(CatalogTransaction transaction,
|
57
|
+
CreatePragmaFunctionInfo &info) override;
|
58
|
+
optional_ptr<CatalogEntry> CreateCollation(CatalogTransaction transaction, CreateCollationInfo &info) override;
|
59
|
+
optional_ptr<CatalogEntry> CreateType(CatalogTransaction transaction, CreateTypeInfo &info) override;
|
60
|
+
void Alter(ClientContext &context, AlterInfo &info) override;
|
61
|
+
void Scan(ClientContext &context, CatalogType type, const std::function<void(CatalogEntry &)> &callback) override;
|
62
|
+
void Scan(CatalogType type, const std::function<void(CatalogEntry &)> &callback) override;
|
63
|
+
void DropEntry(ClientContext &context, DropInfo &info) override;
|
64
|
+
optional_ptr<CatalogEntry> GetEntry(CatalogTransaction transaction, CatalogType type, const string &name) override;
|
61
65
|
SimilarCatalogEntry GetSimilarEntry(CatalogTransaction transaction, CatalogType type, const string &name) override;
|
62
66
|
|
63
67
|
void Verify(Catalog &catalog) override;
|
@@ -16,12 +16,12 @@ namespace duckdb {
|
|
16
16
|
class DuckTableEntry : public TableCatalogEntry {
|
17
17
|
public:
|
18
18
|
//! Create a TableCatalogEntry and initialize storage for it
|
19
|
-
DuckTableEntry(Catalog
|
19
|
+
DuckTableEntry(Catalog &catalog, SchemaCatalogEntry &schema, BoundCreateTableInfo &info,
|
20
20
|
std::shared_ptr<DataTable> inherited_storage = nullptr);
|
21
21
|
|
22
22
|
public:
|
23
|
-
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo
|
24
|
-
void UndoAlter(ClientContext &context, AlterInfo
|
23
|
+
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
|
24
|
+
void UndoAlter(ClientContext &context, AlterInfo &info) override;
|
25
25
|
//! Returns the underlying storage of the table
|
26
26
|
DataTable &GetStorage() override;
|
27
27
|
//! Returns a list of the bound constraints of the table
|
@@ -25,7 +25,7 @@ public:
|
|
25
25
|
|
26
26
|
public:
|
27
27
|
//! Create an IndexCatalogEntry and initialize storage for it
|
28
|
-
IndexCatalogEntry(Catalog
|
28
|
+
IndexCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateIndexInfo &info);
|
29
29
|
|
30
30
|
optional_ptr<Index> index;
|
31
31
|
string sql;
|
@@ -18,7 +18,7 @@ namespace duckdb {
|
|
18
18
|
//! A macro function in the catalog
|
19
19
|
class MacroCatalogEntry : public StandardEntry {
|
20
20
|
public:
|
21
|
-
MacroCatalogEntry(Catalog
|
21
|
+
MacroCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateMacroInfo &info);
|
22
22
|
|
23
23
|
//! The macro function
|
24
24
|
unique_ptr<MacroFunction> function;
|
@@ -28,7 +28,7 @@ public:
|
|
28
28
|
virtual void Serialize(Serializer &serializer) const = 0;
|
29
29
|
|
30
30
|
string ToSQL() const override {
|
31
|
-
return function->ToSQL(schema
|
31
|
+
return function->ToSQL(schema.name, name);
|
32
32
|
}
|
33
33
|
};
|
34
34
|
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp
CHANGED
@@ -24,7 +24,7 @@ public:
|
|
24
24
|
static constexpr const char *Name = "pragma function";
|
25
25
|
|
26
26
|
public:
|
27
|
-
PragmaFunctionCatalogEntry(Catalog
|
27
|
+
PragmaFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreatePragmaFunctionInfo &info);
|
28
28
|
|
29
29
|
//! The pragma functions
|
30
30
|
PragmaFunctionSet functions;
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp
CHANGED
@@ -22,12 +22,12 @@ public:
|
|
22
22
|
static constexpr const char *Name = "scalar function";
|
23
23
|
|
24
24
|
public:
|
25
|
-
ScalarFunctionCatalogEntry(Catalog
|
25
|
+
ScalarFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateScalarFunctionInfo &info);
|
26
26
|
|
27
27
|
//! The scalar functions
|
28
28
|
ScalarFunctionSet functions;
|
29
29
|
|
30
30
|
public:
|
31
|
-
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo
|
31
|
+
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
|
32
32
|
};
|
33
33
|
} // namespace duckdb
|
@@ -22,7 +22,7 @@ public:
|
|
22
22
|
static constexpr const char *Name = "macro function";
|
23
23
|
|
24
24
|
public:
|
25
|
-
ScalarMacroCatalogEntry(Catalog
|
25
|
+
ScalarMacroCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateMacroInfo &info);
|
26
26
|
|
27
27
|
public:
|
28
28
|
//! Serialize the meta information of the ScalarMacroCatalogEntry
|
@@ -40,20 +40,20 @@ struct CreateTypeInfo;
|
|
40
40
|
struct DropInfo;
|
41
41
|
|
42
42
|
//! A schema in the catalog
|
43
|
-
class SchemaCatalogEntry : public
|
43
|
+
class SchemaCatalogEntry : public InCatalogEntry {
|
44
44
|
public:
|
45
45
|
static constexpr const CatalogType Type = CatalogType::SCHEMA_ENTRY;
|
46
46
|
static constexpr const char *Name = "schema";
|
47
47
|
|
48
48
|
public:
|
49
|
-
SchemaCatalogEntry(Catalog
|
49
|
+
SchemaCatalogEntry(Catalog &catalog, string name, bool is_internal);
|
50
50
|
|
51
51
|
public:
|
52
52
|
//! Scan the specified catalog set, invoking the callback method for every entry
|
53
53
|
virtual void Scan(ClientContext &context, CatalogType type,
|
54
|
-
const std::function<void(CatalogEntry
|
54
|
+
const std::function<void(CatalogEntry &)> &callback) = 0;
|
55
55
|
//! Scan the specified catalog set, invoking the callback method for every committed entry
|
56
|
-
virtual void Scan(CatalogType type, const std::function<void(CatalogEntry
|
56
|
+
virtual void Scan(CatalogType type, const std::function<void(CatalogEntry &)> &callback) = 0;
|
57
57
|
|
58
58
|
//! Serialize the meta information of the SchemaCatalogEntry a serializer
|
59
59
|
virtual void Serialize(Serializer &serializer) const;
|
@@ -63,35 +63,40 @@ public:
|
|
63
63
|
string ToSQL() const override;
|
64
64
|
|
65
65
|
//! Creates an index with the given name in the schema
|
66
|
-
virtual CatalogEntry
|
66
|
+
virtual optional_ptr<CatalogEntry> CreateIndex(ClientContext &context, CreateIndexInfo &info,
|
67
|
+
TableCatalogEntry &table) = 0;
|
67
68
|
//! Create a scalar or aggregate function within the given schema
|
68
|
-
virtual CatalogEntry
|
69
|
+
virtual optional_ptr<CatalogEntry> CreateFunction(CatalogTransaction transaction, CreateFunctionInfo &info) = 0;
|
69
70
|
//! Creates a table with the given name in the schema
|
70
|
-
virtual CatalogEntry
|
71
|
+
virtual optional_ptr<CatalogEntry> CreateTable(CatalogTransaction transaction, BoundCreateTableInfo &info) = 0;
|
71
72
|
//! Creates a view with the given name in the schema
|
72
|
-
virtual CatalogEntry
|
73
|
+
virtual optional_ptr<CatalogEntry> CreateView(CatalogTransaction transaction, CreateViewInfo &info) = 0;
|
73
74
|
//! Creates a sequence with the given name in the schema
|
74
|
-
virtual CatalogEntry
|
75
|
+
virtual optional_ptr<CatalogEntry> CreateSequence(CatalogTransaction transaction, CreateSequenceInfo &info) = 0;
|
75
76
|
//! Create a table function within the given schema
|
76
|
-
virtual CatalogEntry
|
77
|
+
virtual optional_ptr<CatalogEntry> CreateTableFunction(CatalogTransaction transaction,
|
78
|
+
CreateTableFunctionInfo &info) = 0;
|
77
79
|
//! Create a copy function within the given schema
|
78
|
-
virtual CatalogEntry
|
80
|
+
virtual optional_ptr<CatalogEntry> CreateCopyFunction(CatalogTransaction transaction,
|
81
|
+
CreateCopyFunctionInfo &info) = 0;
|
79
82
|
//! Create a pragma function within the given schema
|
80
|
-
virtual CatalogEntry
|
83
|
+
virtual optional_ptr<CatalogEntry> CreatePragmaFunction(CatalogTransaction transaction,
|
84
|
+
CreatePragmaFunctionInfo &info) = 0;
|
81
85
|
//! Create a collation within the given schema
|
82
|
-
virtual CatalogEntry
|
86
|
+
virtual optional_ptr<CatalogEntry> CreateCollation(CatalogTransaction transaction, CreateCollationInfo &info) = 0;
|
83
87
|
//! Create a enum within the given schema
|
84
|
-
virtual CatalogEntry
|
88
|
+
virtual optional_ptr<CatalogEntry> CreateType(CatalogTransaction transaction, CreateTypeInfo &info) = 0;
|
85
89
|
|
86
|
-
DUCKDB_API virtual CatalogEntry
|
90
|
+
DUCKDB_API virtual optional_ptr<CatalogEntry> GetEntry(CatalogTransaction transaction, CatalogType type,
|
91
|
+
const string &name) = 0;
|
87
92
|
DUCKDB_API virtual SimilarCatalogEntry GetSimilarEntry(CatalogTransaction transaction, CatalogType type,
|
88
93
|
const string &name);
|
89
94
|
|
90
95
|
//! Drops an entry from the schema
|
91
|
-
virtual void DropEntry(ClientContext &context, DropInfo
|
96
|
+
virtual void DropEntry(ClientContext &context, DropInfo &info) = 0;
|
92
97
|
|
93
98
|
//! Alters a catalog entry
|
94
|
-
virtual void Alter(ClientContext &context, AlterInfo
|
99
|
+
virtual void Alter(ClientContext &context, AlterInfo &info) = 0;
|
95
100
|
|
96
101
|
CatalogTransaction GetCatalogTransaction(ClientContext &context);
|
97
102
|
};
|
@@ -35,7 +35,7 @@ public:
|
|
35
35
|
|
36
36
|
public:
|
37
37
|
//! Create a real TableCatalogEntry and initialize storage for it
|
38
|
-
SequenceCatalogEntry(Catalog
|
38
|
+
SequenceCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateSequenceInfo &info);
|
39
39
|
|
40
40
|
//! Lock for getting a value on the sequence
|
41
41
|
mutex lock;
|
@@ -48,7 +48,7 @@ public:
|
|
48
48
|
|
49
49
|
public:
|
50
50
|
//! Create a TableCatalogEntry and initialize storage for it
|
51
|
-
DUCKDB_API TableCatalogEntry(Catalog
|
51
|
+
DUCKDB_API TableCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateTableInfo &info);
|
52
52
|
|
53
53
|
public:
|
54
54
|
DUCKDB_API bool HasGeneratedColumns() const;
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp
CHANGED
@@ -22,12 +22,12 @@ public:
|
|
22
22
|
static constexpr const char *Name = "table function";
|
23
23
|
|
24
24
|
public:
|
25
|
-
TableFunctionCatalogEntry(Catalog
|
25
|
+
TableFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateTableFunctionInfo &info);
|
26
26
|
|
27
27
|
//! The table function
|
28
28
|
TableFunctionSet functions;
|
29
29
|
|
30
30
|
public:
|
31
|
-
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo
|
31
|
+
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
|
32
32
|
};
|
33
33
|
} // namespace duckdb
|
@@ -21,7 +21,7 @@ public:
|
|
21
21
|
static constexpr const char *Name = "table macro function";
|
22
22
|
|
23
23
|
public:
|
24
|
-
TableMacroCatalogEntry(Catalog
|
24
|
+
TableMacroCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateMacroInfo &info);
|
25
25
|
|
26
26
|
public:
|
27
27
|
//! Serialize the meta information of the ScalarMacroCatalogEntry
|
@@ -24,7 +24,7 @@ public:
|
|
24
24
|
|
25
25
|
public:
|
26
26
|
//! Create a TypeCatalogEntry and initialize storage for it
|
27
|
-
TypeCatalogEntry(Catalog
|
27
|
+
TypeCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateTypeInfo &info);
|
28
28
|
|
29
29
|
LogicalType user_type;
|
30
30
|
|
@@ -26,7 +26,7 @@ public:
|
|
26
26
|
|
27
27
|
public:
|
28
28
|
//! Create a real TableCatalogEntry and initialize storage for it
|
29
|
-
ViewCatalogEntry(Catalog
|
29
|
+
ViewCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateViewInfo &info);
|
30
30
|
|
31
31
|
//! The query of the view
|
32
32
|
unique_ptr<SelectStatement> query;
|
@@ -38,7 +38,7 @@ public:
|
|
38
38
|
vector<LogicalType> types;
|
39
39
|
|
40
40
|
public:
|
41
|
-
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo
|
41
|
+
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info) override;
|
42
42
|
|
43
43
|
//! Serialize the meta information of the ViewCatalogEntry a serializer
|
44
44
|
virtual void Serialize(Serializer &serializer) const;
|
@@ -50,6 +50,6 @@ public:
|
|
50
50
|
string ToSQL() const override;
|
51
51
|
|
52
52
|
private:
|
53
|
-
void Initialize(CreateViewInfo
|
53
|
+
void Initialize(CreateViewInfo &info);
|
54
54
|
};
|
55
55
|
} // namespace duckdb
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "duckdb/common/enums/catalog_type.hpp"
|
13
13
|
#include "duckdb/common/exception.hpp"
|
14
14
|
#include "duckdb/common/atomic.hpp"
|
15
|
+
#include "duckdb/common/optional_ptr.hpp"
|
15
16
|
#include <memory>
|
16
17
|
|
17
18
|
namespace duckdb {
|
@@ -19,21 +20,21 @@ struct AlterInfo;
|
|
19
20
|
class Catalog;
|
20
21
|
class CatalogSet;
|
21
22
|
class ClientContext;
|
23
|
+
class SchemaCatalogEntry;
|
22
24
|
|
23
25
|
//! Abstract base class of an entry in the catalog
|
24
26
|
class CatalogEntry {
|
25
27
|
public:
|
26
|
-
CatalogEntry(CatalogType type, Catalog
|
28
|
+
CatalogEntry(CatalogType type, Catalog &catalog, string name);
|
29
|
+
CatalogEntry(CatalogType type, string name, idx_t oid);
|
27
30
|
virtual ~CatalogEntry();
|
28
31
|
|
29
32
|
//! The oid of the entry
|
30
33
|
idx_t oid;
|
31
34
|
//! The type of this catalog entry
|
32
35
|
CatalogType type;
|
33
|
-
//! Reference to the catalog this entry belongs to
|
34
|
-
Catalog *catalog;
|
35
36
|
//! Reference to the catalog set this entry is stored in
|
36
|
-
CatalogSet
|
37
|
+
optional_ptr<CatalogSet> set;
|
37
38
|
//! The name of the entry
|
38
39
|
string name;
|
39
40
|
//! Whether or not the object is deleted
|
@@ -47,11 +48,11 @@ public:
|
|
47
48
|
//! Child entry
|
48
49
|
unique_ptr<CatalogEntry> child;
|
49
50
|
//! Parent entry (the node that dependents_map this node)
|
50
|
-
CatalogEntry
|
51
|
+
optional_ptr<CatalogEntry> parent;
|
51
52
|
|
52
53
|
public:
|
53
|
-
virtual unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo
|
54
|
-
virtual void UndoAlter(ClientContext &context, AlterInfo
|
54
|
+
virtual unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo &info);
|
55
|
+
virtual void UndoAlter(ClientContext &context, AlterInfo &info);
|
55
56
|
|
56
57
|
virtual unique_ptr<CatalogEntry> Copy(ClientContext &context) const;
|
57
58
|
|
@@ -62,6 +63,9 @@ public:
|
|
62
63
|
//! Convert the catalog entry to a SQL string that can be used to re-construct the catalog entry
|
63
64
|
virtual string ToSQL() const;
|
64
65
|
|
66
|
+
virtual Catalog &ParentCatalog();
|
67
|
+
virtual SchemaCatalogEntry &ParentSchema();
|
68
|
+
|
65
69
|
virtual void Verify(Catalog &catalog);
|
66
70
|
|
67
71
|
public:
|
@@ -76,4 +80,21 @@ public:
|
|
76
80
|
return (const TARGET &)*this;
|
77
81
|
}
|
78
82
|
};
|
83
|
+
|
84
|
+
class InCatalogEntry : public CatalogEntry {
|
85
|
+
public:
|
86
|
+
InCatalogEntry(CatalogType type, Catalog &catalog, string name);
|
87
|
+
~InCatalogEntry() override;
|
88
|
+
|
89
|
+
//! The catalog the entry belongs to
|
90
|
+
Catalog &catalog;
|
91
|
+
|
92
|
+
public:
|
93
|
+
Catalog &ParentCatalog() override {
|
94
|
+
return catalog;
|
95
|
+
}
|
96
|
+
|
97
|
+
void Verify(Catalog &catalog) override;
|
98
|
+
};
|
99
|
+
|
79
100
|
} // namespace duckdb
|
@@ -79,7 +79,7 @@ public:
|
|
79
79
|
DUCKDB_API bool CreateEntry(ClientContext &context, const string &name, unique_ptr<CatalogEntry> value,
|
80
80
|
DependencyList &dependencies);
|
81
81
|
|
82
|
-
DUCKDB_API bool AlterEntry(CatalogTransaction transaction, const string &name, AlterInfo
|
82
|
+
DUCKDB_API bool AlterEntry(CatalogTransaction transaction, const string &name, AlterInfo &alter_info);
|
83
83
|
|
84
84
|
DUCKDB_API bool DropEntry(CatalogTransaction transaction, const string &name, bool cascade,
|
85
85
|
bool allow_drop_internal = false);
|
@@ -88,13 +88,13 @@ public:
|
|
88
88
|
|
89
89
|
DUCKDB_API DuckCatalog &GetCatalog();
|
90
90
|
|
91
|
-
bool AlterOwnership(CatalogTransaction transaction, ChangeOwnershipInfo
|
91
|
+
bool AlterOwnership(CatalogTransaction transaction, ChangeOwnershipInfo &info);
|
92
92
|
|
93
|
-
void CleanupEntry(CatalogEntry
|
93
|
+
void CleanupEntry(CatalogEntry &catalog_entry);
|
94
94
|
|
95
95
|
//! Returns the entry with the specified name
|
96
|
-
DUCKDB_API CatalogEntry
|
97
|
-
DUCKDB_API CatalogEntry
|
96
|
+
DUCKDB_API optional_ptr<CatalogEntry> GetEntry(CatalogTransaction transaction, const string &name);
|
97
|
+
DUCKDB_API optional_ptr<CatalogEntry> GetEntry(ClientContext &context, const string &name);
|
98
98
|
|
99
99
|
//! Gets the entry that is most similar to the given name (i.e. smallest levenshtein distance), or empty string if
|
100
100
|
//! none is found. The returned pair consists of the entry name and the distance (smaller means closer).
|
@@ -105,15 +105,15 @@ public:
|
|
105
105
|
void Undo(CatalogEntry &entry);
|
106
106
|
|
107
107
|
//! Scan the catalog set, invoking the callback method for every committed entry
|
108
|
-
DUCKDB_API void Scan(const std::function<void(CatalogEntry
|
108
|
+
DUCKDB_API void Scan(const std::function<void(CatalogEntry &)> &callback);
|
109
109
|
//! Scan the catalog set, invoking the callback method for every entry
|
110
|
-
DUCKDB_API void Scan(CatalogTransaction transaction, const std::function<void(CatalogEntry
|
111
|
-
DUCKDB_API void Scan(ClientContext &context, const std::function<void(CatalogEntry
|
110
|
+
DUCKDB_API void Scan(CatalogTransaction transaction, const std::function<void(CatalogEntry &)> &callback);
|
111
|
+
DUCKDB_API void Scan(ClientContext &context, const std::function<void(CatalogEntry &)> &callback);
|
112
112
|
|
113
113
|
template <class T>
|
114
|
-
vector<T
|
115
|
-
vector<T
|
116
|
-
Scan(transaction, [&](CatalogEntry
|
114
|
+
vector<reference<T>> GetEntries(CatalogTransaction transaction) {
|
115
|
+
vector<reference<T>> result;
|
116
|
+
Scan(transaction, [&](CatalogEntry &entry) { result.push_back(entry.Cast<T>()); });
|
117
117
|
return result;
|
118
118
|
}
|
119
119
|
|
@@ -132,15 +132,15 @@ private:
|
|
132
132
|
//! Adjust User dependency
|
133
133
|
void AdjustUserDependency(CatalogEntry &entry, ColumnDefinition &column, bool remove);
|
134
134
|
//! Given a root entry, gets the entry valid for this transaction
|
135
|
-
CatalogEntry
|
136
|
-
CatalogEntry
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
CatalogEntry &GetEntryForTransaction(CatalogTransaction transaction, CatalogEntry ¤t);
|
136
|
+
CatalogEntry &GetCommittedEntry(CatalogEntry ¤t);
|
137
|
+
optional_ptr<CatalogEntry> GetEntryInternal(CatalogTransaction transaction, const string &name,
|
138
|
+
EntryIndex *entry_index);
|
139
|
+
optional_ptr<CatalogEntry> GetEntryInternal(CatalogTransaction transaction, EntryIndex &entry_index);
|
140
140
|
//! Drops an entry from the catalog set; must hold the catalog_lock to safely call this
|
141
141
|
void DropEntryInternal(CatalogTransaction transaction, EntryIndex entry_index, CatalogEntry &entry, bool cascade);
|
142
|
-
CatalogEntry
|
143
|
-
MappingValue
|
142
|
+
optional_ptr<CatalogEntry> CreateEntryInternal(CatalogTransaction transaction, unique_ptr<CatalogEntry> entry);
|
143
|
+
optional_ptr<MappingValue> GetMapping(CatalogTransaction transaction, const string &name, bool get_latest = false);
|
144
144
|
void PutMapping(CatalogTransaction transaction, const string &name, EntryIndex entry_index);
|
145
145
|
void DeleteMapping(CatalogTransaction transaction, const string &name);
|
146
146
|
void DropEntryDependencies(CatalogTransaction transaction, EntryIndex &entry_index, CatalogEntry &entry,
|
@@ -149,7 +149,8 @@ private:
|
|
149
149
|
//! Create all default entries
|
150
150
|
void CreateDefaultEntries(CatalogTransaction transaction, unique_lock<mutex> &lock);
|
151
151
|
//! Attempt to create a default entry with the specified name. Returns the entry if successful, nullptr otherwise.
|
152
|
-
CatalogEntry
|
152
|
+
optional_ptr<CatalogEntry> CreateDefaultEntry(CatalogTransaction transaction, const string &name,
|
153
|
+
unique_lock<mutex> &lock);
|
153
154
|
|
154
155
|
EntryIndex PutEntry(idx_t entry_index, unique_ptr<CatalogEntry> entry);
|
155
156
|
void PutEntry(EntryIndex index, unique_ptr<CatalogEntry> entry);
|
@@ -33,13 +33,13 @@ public:
|
|
33
33
|
}
|
34
34
|
|
35
35
|
public:
|
36
|
-
DUCKDB_API CatalogEntry
|
37
|
-
DUCKDB_API void ScanSchemas(ClientContext &context, std::function<void(
|
38
|
-
DUCKDB_API void ScanSchemas(std::function<void(
|
36
|
+
DUCKDB_API optional_ptr<CatalogEntry> CreateSchema(CatalogTransaction transaction, CreateSchemaInfo &info) override;
|
37
|
+
DUCKDB_API void ScanSchemas(ClientContext &context, std::function<void(SchemaCatalogEntry &)> callback) override;
|
38
|
+
DUCKDB_API void ScanSchemas(std::function<void(SchemaCatalogEntry &)> callback);
|
39
39
|
|
40
|
-
DUCKDB_API SchemaCatalogEntry
|
41
|
-
|
42
|
-
|
40
|
+
DUCKDB_API optional_ptr<SchemaCatalogEntry>
|
41
|
+
GetSchema(CatalogTransaction transaction, const string &schema_name, OnEntryNotFound if_not_found,
|
42
|
+
QueryErrorContext error_context = QueryErrorContext()) override;
|
43
43
|
|
44
44
|
DUCKDB_API unique_ptr<PhysicalOperator> PlanCreateTableAs(ClientContext &context, LogicalCreateTable &op,
|
45
45
|
unique_ptr<PhysicalOperator> plan) override;
|
@@ -59,9 +59,9 @@ public:
|
|
59
59
|
DUCKDB_API string GetDBPath() override;
|
60
60
|
|
61
61
|
private:
|
62
|
-
DUCKDB_API void DropSchema(CatalogTransaction transaction, DropInfo
|
63
|
-
DUCKDB_API void DropSchema(ClientContext &context, DropInfo
|
64
|
-
CatalogEntry
|
62
|
+
DUCKDB_API void DropSchema(CatalogTransaction transaction, DropInfo &info);
|
63
|
+
DUCKDB_API void DropSchema(ClientContext &context, DropInfo &info) override;
|
64
|
+
optional_ptr<CatalogEntry> CreateSchemaInternal(CatalogTransaction transaction, CreateSchemaInfo &info);
|
65
65
|
void Verify() override;
|
66
66
|
|
67
67
|
private:
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/common/common.hpp"
|
12
|
+
#include "duckdb/common/optional_ptr.hpp"
|
12
13
|
|
13
14
|
namespace duckdb {
|
14
15
|
class SchemaCatalogEntry;
|
@@ -20,7 +21,7 @@ struct SimilarCatalogEntry {
|
|
20
21
|
//! The distance to the given name.
|
21
22
|
idx_t distance = idx_t(-1);
|
22
23
|
//! The schema of the entry.
|
23
|
-
SchemaCatalogEntry
|
24
|
+
optional_ptr<SchemaCatalogEntry> schema;
|
24
25
|
|
25
26
|
DUCKDB_API bool Found() const {
|
26
27
|
return !name.empty();
|
@@ -14,15 +14,21 @@ namespace duckdb {
|
|
14
14
|
class SchemaCatalogEntry;
|
15
15
|
|
16
16
|
//! A StandardEntry is a catalog entry that is a member of a schema
|
17
|
-
class StandardEntry : public
|
17
|
+
class StandardEntry : public InCatalogEntry {
|
18
18
|
public:
|
19
|
-
StandardEntry(CatalogType type, SchemaCatalogEntry
|
20
|
-
:
|
19
|
+
StandardEntry(CatalogType type, SchemaCatalogEntry &schema, Catalog &catalog, string name)
|
20
|
+
: InCatalogEntry(type, catalog, name), schema(schema) {
|
21
21
|
}
|
22
22
|
~StandardEntry() override {
|
23
23
|
}
|
24
24
|
|
25
25
|
//! The schema the entry belongs to
|
26
|
-
SchemaCatalogEntry
|
26
|
+
SchemaCatalogEntry &schema;
|
27
|
+
|
28
|
+
public:
|
29
|
+
SchemaCatalogEntry &ParentSchema() override {
|
30
|
+
return schema;
|
31
|
+
}
|
27
32
|
};
|
33
|
+
|
28
34
|
} // namespace duckdb
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
2
|
+
// DuckDB
|
3
|
+
//
|
4
|
+
// duckdb/common/enums/on_entry_not_found.hpp
|
5
|
+
//
|
6
|
+
//
|
7
|
+
//===----------------------------------------------------------------------===//
|
8
|
+
|
9
|
+
#pragma once
|
10
|
+
|
11
|
+
#include "duckdb/common/constants.hpp"
|
12
|
+
|
13
|
+
namespace duckdb {
|
14
|
+
|
15
|
+
enum class OnEntryNotFound : uint8_t { THROW_EXCEPTION = 0, RETURN_NULL = 1 };
|
16
|
+
|
17
|
+
} // namespace duckdb
|
@@ -10,6 +10,7 @@
|
|
10
10
|
|
11
11
|
#include "duckdb/common/assert.hpp"
|
12
12
|
#include "duckdb/common/constants.hpp"
|
13
|
+
#include "duckdb/common/optional_ptr.hpp"
|
13
14
|
#include "duckdb/common/vector.hpp"
|
14
15
|
|
15
16
|
#include <limits>
|
@@ -326,8 +327,6 @@ struct LogicalType {
|
|
326
327
|
DUCKDB_API string GetAlias() const;
|
327
328
|
|
328
329
|
DUCKDB_API static LogicalType MaxLogicalType(const LogicalType &left, const LogicalType &right);
|
329
|
-
DUCKDB_API static void SetCatalog(LogicalType &type, TypeCatalogEntry* catalog_entry);
|
330
|
-
DUCKDB_API static TypeCatalogEntry* GetCatalog(const LogicalType &type);
|
331
330
|
|
332
331
|
DUCKDB_API static ExtraTypeInfoType GetExtraTypeInfoType(const ExtraTypeInfo &type);
|
333
332
|
|
@@ -426,8 +425,8 @@ struct EnumType{
|
|
426
425
|
DUCKDB_API static const Vector &GetValuesInsertOrder(const LogicalType &type);
|
427
426
|
DUCKDB_API static idx_t GetSize(const LogicalType &type);
|
428
427
|
DUCKDB_API static const string GetValue(const Value &val);
|
429
|
-
DUCKDB_API static void SetCatalog(LogicalType &type, TypeCatalogEntry
|
430
|
-
DUCKDB_API static TypeCatalogEntry
|
428
|
+
DUCKDB_API static void SetCatalog(LogicalType &type, optional_ptr<TypeCatalogEntry> catalog_entry);
|
429
|
+
DUCKDB_API static optional_ptr<TypeCatalogEntry> GetCatalog(const LogicalType &type);
|
431
430
|
DUCKDB_API static string GetSchemaName(const LogicalType &type);
|
432
431
|
DUCKDB_API static PhysicalType GetPhysicalType(const LogicalType &type);
|
433
432
|
DUCKDB_API static void Serialize(FieldWriter& writer, const ExtraTypeInfo& type_info, bool serialize_internals);
|
@@ -47,13 +47,13 @@ public:
|
|
47
47
|
// note: original_arguments are optional (can be list of size 0)
|
48
48
|
auto original_arguments = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
49
49
|
|
50
|
-
auto func_catalog = Catalog::GetEntry(context, type, SYSTEM_CATALOG, DEFAULT_SCHEMA, name);
|
51
|
-
if (
|
50
|
+
auto &func_catalog = Catalog::GetEntry(context, type, SYSTEM_CATALOG, DEFAULT_SCHEMA, name);
|
51
|
+
if (func_catalog.type != type) {
|
52
52
|
throw InternalException("Cant find catalog entry for function %s", name);
|
53
53
|
}
|
54
54
|
|
55
|
-
auto functions = (
|
56
|
-
auto function = functions
|
55
|
+
auto &functions = func_catalog.Cast<CATALOG_ENTRY>();
|
56
|
+
auto function = functions.functions.GetFunctionByArguments(
|
57
57
|
state.context, original_arguments.empty() ? arguments : original_arguments);
|
58
58
|
function.arguments = std::move(arguments);
|
59
59
|
function.original_arguments = std::move(original_arguments);
|