duckdb 0.6.2-dev772.0 → 0.6.2-dev889.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/binding.gyp +1 -1
- package/package.json +1 -1
- package/src/connection.cpp +2 -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 +1 -1
- package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +2 -2
- package/src/duckdb/extension/icu/icu-timezone.cpp +6 -5
- package/src/duckdb/extension/json/json-extension.cpp +1 -1
- package/src/duckdb/extension/parquet/parquet-extension.cpp +1 -1
- package/src/duckdb/src/catalog/catalog.cpp +516 -177
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +1 -0
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +66 -49
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +15 -16
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry.cpp +6 -2
- package/src/duckdb/src/catalog/catalog_search_path.cpp +177 -22
- package/src/duckdb/src/catalog/catalog_set.cpp +134 -72
- package/src/duckdb/src/catalog/catalog_transaction.cpp +28 -0
- package/src/duckdb/src/catalog/default/default_views.cpp +4 -4
- package/src/duckdb/src/catalog/dependency_list.cpp +13 -0
- package/src/duckdb/src/catalog/dependency_manager.cpp +19 -13
- package/src/duckdb/src/common/constants.cpp +8 -0
- package/src/duckdb/src/common/enums/catalog_type.cpp +2 -0
- package/src/duckdb/src/common/enums/logical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/enums/statement_type.cpp +2 -0
- package/src/duckdb/src/common/file_system.cpp +1 -1
- package/src/duckdb/src/common/string_util.cpp +5 -1
- package/src/duckdb/src/execution/index/art/art.cpp +1 -1
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +1 -0
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +3 -2
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +4 -3
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +72 -0
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +2 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +3 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +5 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +2 -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 +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +2 -1
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +10 -2
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +2 -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_simple.cpp +4 -0
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan_generator.cpp +3 -2
- package/src/duckdb/src/function/built_in_functions.cpp +88 -0
- package/src/duckdb/src/function/function.cpp +0 -79
- package/src/duckdb/src/function/function_binder.cpp +2 -1
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +10 -1
- package/src/duckdb/src/function/scalar/date/current.cpp +2 -2
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +3 -2
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +14 -17
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +2 -2
- package/src/duckdb/src/function/scalar/system/system_functions.cpp +7 -4
- package/src/duckdb/src/function/table/checkpoint.cpp +37 -4
- package/src/duckdb/src/function/table/read_csv.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +32 -25
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +26 -22
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +22 -15
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +25 -18
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +16 -8
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +26 -19
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +24 -17
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +22 -16
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +20 -13
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +3 -4
- package/src/duckdb/src/function/table/system/pragma_database_list.cpp +20 -12
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +39 -24
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +1 -7
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +3 -2
- package/src/duckdb/src/function/table/system_functions.cpp +0 -1
- package/src/duckdb/src/function/table/table_scan.cpp +13 -10
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +102 -81
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/collate_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +21 -14
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +4 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +2 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +30 -11
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +35 -20
- package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +32 -0
- package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +27 -0
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +6 -4
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/constants.hpp +8 -3
- package/src/duckdb/src/include/duckdb/common/enums/catalog_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +10 -4
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +33 -0
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/function/aggregate/algebraic_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/aggregate/holistic_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/aggregate/nested_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/aggregate/regression_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/built_in_functions.hpp +78 -0
- package/src/duckdb/src/include/duckdb/function/function.hpp +0 -61
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +1 -2
- package/src/duckdb/src/include/duckdb/function/pragma/pragma_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/blob_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/date_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/enum_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/operators.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/sequence_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/trigonometric_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar/uuid_functions.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +2 -1
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/table/range.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/table/summary.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/table/system_functions.hpp +1 -4
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +64 -0
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/database.hpp +6 -6
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +69 -0
- package/src/duckdb/src/include/duckdb/main/settings.hpp +10 -0
- package/src/duckdb/src/include/duckdb/main/valid_checker.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_function_info.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +18 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +53 -56
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +39 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_aggregate_function_info.hpp +3 -18
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_collation_info.hpp +4 -13
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_copy_function_info.hpp +3 -12
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_index_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_info.hpp +5 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_pragma_function_info.hpp +3 -14
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_function_info.hpp +3 -19
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +3 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +7 -34
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +7 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/qualified_name.hpp +10 -2
- package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/statement/attach_statement.hpp +29 -0
- package/src/duckdb/src/include/duckdb/parser/statement/export_statement.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/statement/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/tokens.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +11 -1
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +13 -6
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +10 -2
- package/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +9 -12
- package/src/duckdb/src/include/duckdb/storage/table/data_table_info.hpp +3 -7
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +5 -6
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +9 -7
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +3 -1
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +64 -0
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +14 -23
- package/src/duckdb/src/include/duckdb/transaction/transaction_context.hpp +12 -8
- package/src/duckdb/src/include/duckdb/transaction/transaction_manager.hpp +5 -10
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +1 -1
- package/src/duckdb/src/main/attached_database.cpp +97 -0
- package/src/duckdb/src/main/capi/table_function-c.cpp +1 -1
- package/src/duckdb/src/main/client_context.cpp +28 -22
- package/src/duckdb/src/main/client_data.cpp +5 -2
- package/src/duckdb/src/main/config.cpp +1 -0
- package/src/duckdb/src/main/connection.cpp +1 -1
- package/src/duckdb/src/main/database.cpp +54 -40
- package/src/duckdb/src/main/database_manager.cpp +95 -0
- package/src/duckdb/src/main/materialized_query_result.cpp +1 -1
- package/src/duckdb/src/main/prepared_statement_data.cpp +1 -2
- package/src/duckdb/src/main/query_result.cpp +4 -4
- package/src/duckdb/src/main/settings/settings.cpp +22 -6
- package/src/duckdb/src/main/stream_query_result.cpp +1 -1
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +9 -3
- package/src/duckdb/src/parser/expression/function_expression.cpp +15 -13
- package/src/duckdb/src/parser/expression/window_expression.cpp +6 -4
- package/src/duckdb/src/parser/parsed_data/alter_function_info.cpp +7 -7
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +12 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +96 -98
- package/src/duckdb/src/parser/parsed_data/create_aggregate_function_info.cpp +27 -0
- package/src/duckdb/src/parser/parsed_data/create_collation_info.cpp +23 -0
- package/src/duckdb/src/parser/parsed_data/create_copy_function_info.cpp +21 -0
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +3 -0
- package/src/duckdb/src/parser/parsed_data/create_pragma_function_info.cpp +23 -0
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +3 -1
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +28 -0
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +9 -3
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +49 -0
- package/src/duckdb/src/parser/statement/attach_statement.cpp +15 -0
- package/src/duckdb/src/parser/statement/insert_statement.cpp +6 -2
- package/src/duckdb/src/parser/tableref/basetableref.cpp +9 -4
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +15 -13
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +17 -7
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +4 -9
- package/src/duckdb/src/parser/transform/helpers/nodetype_to_string.cpp +4 -0
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +5 -4
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +8 -10
- package/src/duckdb/src/parser/transform/statement/transform_attach.cpp +32 -0
- package/src/duckdb/src/parser/transform/statement/transform_checkpoint.cpp +7 -2
- package/src/duckdb/src/parser/transform/statement/transform_copy.cpp +1 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +1 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_schema.cpp +1 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_sequence.cpp +1 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +5 -5
- package/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +1 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +6 -13
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +6 -6
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +11 -2
- package/src/duckdb/src/parser/transform/statement/transform_export.cpp +5 -1
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +1 -0
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +12 -36
- package/src/duckdb/src/parser/transform/statement/transform_show.cpp +3 -1
- package/src/duckdb/src/parser/transform/statement/transform_use.cpp +21 -0
- package/src/duckdb/src/parser/transform/tableref/transform_base_tableref.cpp +11 -3
- package/src/duckdb/src/parser/transformer.cpp +4 -0
- package/src/duckdb/src/planner/bind_context.cpp +11 -2
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +43 -13
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +2 -3
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +2 -3
- package/src/duckdb/src/planner/binder/statement/bind_attach.cpp +20 -0
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +7 -4
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +79 -27
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +11 -7
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +13 -5
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +6 -3
- package/src/duckdb/src/planner/binder/statement/bind_extension.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +3 -2
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_prepare.cpp +0 -2
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +11 -6
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +10 -6
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +2 -4
- package/src/duckdb/src/planner/binder.cpp +17 -2
- package/src/duckdb/src/planner/logical_operator.cpp +5 -12
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +3 -4
- package/src/duckdb/src/planner/operator/logical_create.cpp +1 -4
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_delete.cpp +2 -3
- package/src/duckdb/src/planner/operator/logical_insert.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_update.cpp +1 -1
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +1 -1
- package/src/duckdb/src/planner/planner.cpp +3 -2
- package/src/duckdb/src/planner/pragma_handler.cpp +1 -1
- package/src/duckdb/src/storage/buffer_manager.cpp +5 -0
- package/src/duckdb/src/storage/checkpoint_manager.cpp +10 -17
- package/src/duckdb/src/storage/data_table.cpp +34 -24
- package/src/duckdb/src/storage/local_storage.cpp +7 -3
- package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -3
- package/src/duckdb/src/storage/storage_manager.cpp +25 -42
- package/src/duckdb/src/storage/table/column_data.cpp +2 -1
- package/src/duckdb/src/storage/table/row_group.cpp +7 -2
- package/src/duckdb/src/storage/wal_replay.cpp +6 -22
- package/src/duckdb/src/storage/write_ahead_log.cpp +3 -3
- package/src/duckdb/src/transaction/meta_transaction.cpp +106 -0
- package/src/duckdb/src/transaction/transaction.cpp +21 -21
- package/src/duckdb/src/transaction/transaction_context.cpp +44 -8
- package/src/duckdb/src/transaction/transaction_manager.cpp +20 -20
- package/src/duckdb/src/transaction/undo_buffer.cpp +1 -3
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +2 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +27 -1
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +99 -97
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +1 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +15206 -14793
- package/src/duckdb/ub_src_catalog.cpp +4 -0
- package/src/duckdb/ub_src_execution_operator_schema.cpp +2 -0
- package/src/duckdb/ub_src_function.cpp +2 -0
- package/src/duckdb/ub_src_function_table_system.cpp +0 -2
- package/src/duckdb/ub_src_main.cpp +4 -0
- package/src/duckdb/ub_src_parser_parsed_data.cpp +12 -0
- package/src/duckdb/ub_src_parser_statement.cpp +2 -0
- package/src/duckdb/ub_src_parser_transform_statement.cpp +4 -0
- package/src/duckdb/ub_src_planner_binder_statement.cpp +2 -0
- package/src/duckdb/ub_src_transaction.cpp +2 -0
- package/src/duckdb/src/function/table/system/pragma_functions.cpp +0 -120
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
#include "duckdb/catalog/catalog_entry.hpp"
|
|
12
12
|
#include "duckdb/common/mutex.hpp"
|
|
13
13
|
#include "duckdb/parser/query_error_context.hpp"
|
|
14
|
+
#include "duckdb/catalog/catalog_transaction.hpp"
|
|
15
|
+
#include "duckdb/common/unordered_set.hpp"
|
|
16
|
+
#include "duckdb/common/atomic.hpp"
|
|
14
17
|
|
|
15
18
|
#include <functional>
|
|
16
|
-
#include "duckdb/common/atomic.hpp"
|
|
17
19
|
|
|
18
20
|
namespace duckdb {
|
|
19
21
|
struct CreateSchemaInfo;
|
|
@@ -30,6 +32,7 @@ struct CreateCollationInfo;
|
|
|
30
32
|
struct CreateTypeInfo;
|
|
31
33
|
struct CreateTableInfo;
|
|
32
34
|
|
|
35
|
+
class AttachedDatabase;
|
|
33
36
|
class ClientContext;
|
|
34
37
|
class Transaction;
|
|
35
38
|
|
|
@@ -46,40 +49,16 @@ class CatalogSet;
|
|
|
46
49
|
class DatabaseInstance;
|
|
47
50
|
class DependencyManager;
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
struct CatalogEntryLookup
|
|
51
|
-
|
|
52
|
-
CatalogEntry *entry;
|
|
53
|
-
|
|
54
|
-
DUCKDB_API bool Found() const {
|
|
55
|
-
return entry;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
//! Return value of SimilarEntryInSchemas
|
|
60
|
-
struct SimilarCatalogEntry {
|
|
61
|
-
//! The entry name. Empty if absent
|
|
62
|
-
string name;
|
|
63
|
-
//! The distance to the given name.
|
|
64
|
-
idx_t distance;
|
|
65
|
-
//! The schema of the entry.
|
|
66
|
-
SchemaCatalogEntry *schema;
|
|
67
|
-
|
|
68
|
-
DUCKDB_API bool Found() const {
|
|
69
|
-
return !name.empty();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
DUCKDB_API string GetQualifiedName() const;
|
|
73
|
-
};
|
|
52
|
+
struct CatalogLookup;
|
|
53
|
+
struct CatalogEntryLookup;
|
|
54
|
+
struct SimilarCatalogEntry;
|
|
74
55
|
|
|
75
56
|
//! The Catalog object represents the catalog of the database.
|
|
76
57
|
class Catalog {
|
|
77
58
|
public:
|
|
78
|
-
explicit Catalog(
|
|
59
|
+
explicit Catalog(AttachedDatabase &db);
|
|
79
60
|
~Catalog();
|
|
80
61
|
|
|
81
|
-
//! Reference to the database
|
|
82
|
-
DatabaseInstance &db;
|
|
83
62
|
//! The catalog set holding the schemas
|
|
84
63
|
unique_ptr<CatalogSet> schemas;
|
|
85
64
|
//! The DependencyManager manages dependencies between different catalog objects
|
|
@@ -88,67 +67,98 @@ public:
|
|
|
88
67
|
mutex write_lock;
|
|
89
68
|
|
|
90
69
|
public:
|
|
91
|
-
//! Get the
|
|
92
|
-
DUCKDB_API static Catalog &
|
|
93
|
-
//! Get the
|
|
94
|
-
DUCKDB_API static Catalog &
|
|
70
|
+
//! Get the SystemCatalog from the ClientContext
|
|
71
|
+
DUCKDB_API static Catalog &GetSystemCatalog(ClientContext &context);
|
|
72
|
+
//! Get the SystemCatalog from the DatabaseInstance
|
|
73
|
+
DUCKDB_API static Catalog &GetSystemCatalog(DatabaseInstance &db);
|
|
74
|
+
//! Get the specified Catalog from the ClientContext
|
|
75
|
+
DUCKDB_API static Catalog &GetCatalog(ClientContext &context, const string &catalog_name);
|
|
76
|
+
//! Get the specified Catalog from the DatabaseInstance
|
|
77
|
+
DUCKDB_API static Catalog &GetCatalog(DatabaseInstance &db, const string &catalog_name);
|
|
78
|
+
//! Get the specific Catalog from the AttachedDatabase
|
|
79
|
+
DUCKDB_API static Catalog &GetCatalog(AttachedDatabase &db);
|
|
95
80
|
|
|
96
81
|
DUCKDB_API DependencyManager &GetDependencyManager() {
|
|
97
82
|
return *dependency_manager;
|
|
98
83
|
}
|
|
84
|
+
DUCKDB_API AttachedDatabase &GetAttached();
|
|
85
|
+
DUCKDB_API DatabaseInstance &GetDatabase();
|
|
86
|
+
|
|
87
|
+
void Initialize(bool load_builtin);
|
|
88
|
+
|
|
89
|
+
bool IsSystemCatalog() const;
|
|
90
|
+
bool IsTemporaryCatalog() const;
|
|
99
91
|
|
|
100
92
|
//! Returns the current version of the catalog (incremented whenever anything changes, not stored between restarts)
|
|
101
93
|
DUCKDB_API idx_t GetCatalogVersion();
|
|
102
94
|
//! Trigger a modification in the catalog, increasing the catalog version and returning the previous version
|
|
103
95
|
DUCKDB_API idx_t ModifyCatalog();
|
|
104
96
|
|
|
97
|
+
//! Returns the catalog name - based on how the catalog was attached
|
|
98
|
+
DUCKDB_API const string &GetName();
|
|
99
|
+
DUCKDB_API idx_t GetOid();
|
|
100
|
+
|
|
101
|
+
DUCKDB_API CatalogTransaction GetCatalogTransaction(ClientContext &context);
|
|
102
|
+
|
|
105
103
|
//! Creates a schema in the catalog.
|
|
104
|
+
DUCKDB_API CatalogEntry *CreateSchema(CatalogTransaction transaction, CreateSchemaInfo *info);
|
|
106
105
|
DUCKDB_API CatalogEntry *CreateSchema(ClientContext &context, CreateSchemaInfo *info);
|
|
107
106
|
//! Creates a table in the catalog.
|
|
107
|
+
DUCKDB_API CatalogEntry *CreateTable(CatalogTransaction transaction, BoundCreateTableInfo *info);
|
|
108
108
|
DUCKDB_API CatalogEntry *CreateTable(ClientContext &context, BoundCreateTableInfo *info);
|
|
109
109
|
//! Creates a table in the catalog.
|
|
110
110
|
DUCKDB_API CatalogEntry *CreateTable(ClientContext &context, unique_ptr<CreateTableInfo> info);
|
|
111
111
|
//! Create a table function in the catalog
|
|
112
|
+
DUCKDB_API CatalogEntry *CreateTableFunction(CatalogTransaction transaction, CreateTableFunctionInfo *info);
|
|
112
113
|
DUCKDB_API CatalogEntry *CreateTableFunction(ClientContext &context, CreateTableFunctionInfo *info);
|
|
113
114
|
//! Create a copy function in the catalog
|
|
115
|
+
DUCKDB_API CatalogEntry *CreateCopyFunction(CatalogTransaction transaction, CreateCopyFunctionInfo *info);
|
|
114
116
|
DUCKDB_API CatalogEntry *CreateCopyFunction(ClientContext &context, CreateCopyFunctionInfo *info);
|
|
115
117
|
//! Create a pragma function in the catalog
|
|
118
|
+
DUCKDB_API CatalogEntry *CreatePragmaFunction(CatalogTransaction transaction, CreatePragmaFunctionInfo *info);
|
|
116
119
|
DUCKDB_API CatalogEntry *CreatePragmaFunction(ClientContext &context, CreatePragmaFunctionInfo *info);
|
|
117
120
|
//! Create a scalar or aggregate function in the catalog
|
|
121
|
+
DUCKDB_API CatalogEntry *CreateFunction(CatalogTransaction transaction, CreateFunctionInfo *info);
|
|
118
122
|
DUCKDB_API CatalogEntry *CreateFunction(ClientContext &context, CreateFunctionInfo *info);
|
|
119
123
|
//! Creates a table in the catalog.
|
|
124
|
+
DUCKDB_API CatalogEntry *CreateView(CatalogTransaction transaction, CreateViewInfo *info);
|
|
120
125
|
DUCKDB_API CatalogEntry *CreateView(ClientContext &context, CreateViewInfo *info);
|
|
121
126
|
//! Creates a sequence in the catalog.
|
|
127
|
+
DUCKDB_API CatalogEntry *CreateSequence(CatalogTransaction transaction, CreateSequenceInfo *info);
|
|
122
128
|
DUCKDB_API CatalogEntry *CreateSequence(ClientContext &context, CreateSequenceInfo *info);
|
|
123
129
|
//! Creates a Enum in the catalog.
|
|
130
|
+
DUCKDB_API CatalogEntry *CreateType(CatalogTransaction transaction, CreateTypeInfo *info);
|
|
124
131
|
DUCKDB_API CatalogEntry *CreateType(ClientContext &context, CreateTypeInfo *info);
|
|
125
132
|
//! Creates a collation in the catalog
|
|
133
|
+
DUCKDB_API CatalogEntry *CreateCollation(CatalogTransaction transaction, CreateCollationInfo *info);
|
|
126
134
|
DUCKDB_API CatalogEntry *CreateCollation(ClientContext &context, CreateCollationInfo *info);
|
|
127
135
|
|
|
128
136
|
//! Creates a table in the catalog.
|
|
129
|
-
DUCKDB_API CatalogEntry *CreateTable(
|
|
137
|
+
DUCKDB_API CatalogEntry *CreateTable(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
130
138
|
BoundCreateTableInfo *info);
|
|
131
139
|
//! Create a table function in the catalog
|
|
132
|
-
DUCKDB_API CatalogEntry *CreateTableFunction(
|
|
140
|
+
DUCKDB_API CatalogEntry *CreateTableFunction(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
133
141
|
CreateTableFunctionInfo *info);
|
|
134
142
|
//! Create a copy function in the catalog
|
|
135
|
-
DUCKDB_API CatalogEntry *CreateCopyFunction(
|
|
143
|
+
DUCKDB_API CatalogEntry *CreateCopyFunction(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
136
144
|
CreateCopyFunctionInfo *info);
|
|
137
145
|
//! Create a pragma function in the catalog
|
|
138
|
-
DUCKDB_API CatalogEntry *CreatePragmaFunction(
|
|
146
|
+
DUCKDB_API CatalogEntry *CreatePragmaFunction(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
139
147
|
CreatePragmaFunctionInfo *info);
|
|
140
148
|
//! Create a scalar or aggregate function in the catalog
|
|
141
|
-
DUCKDB_API CatalogEntry *CreateFunction(
|
|
149
|
+
DUCKDB_API CatalogEntry *CreateFunction(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
142
150
|
CreateFunctionInfo *info);
|
|
143
151
|
//! Creates a table in the catalog.
|
|
144
|
-
DUCKDB_API CatalogEntry *CreateView(
|
|
152
|
+
DUCKDB_API CatalogEntry *CreateView(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
153
|
+
CreateViewInfo *info);
|
|
145
154
|
//! Creates a table in the catalog.
|
|
146
|
-
DUCKDB_API CatalogEntry *CreateSequence(
|
|
155
|
+
DUCKDB_API CatalogEntry *CreateSequence(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
147
156
|
CreateSequenceInfo *info);
|
|
148
157
|
//! Creates a enum in the catalog.
|
|
149
|
-
DUCKDB_API CatalogEntry *CreateType(
|
|
158
|
+
DUCKDB_API CatalogEntry *CreateType(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
159
|
+
CreateTypeInfo *info);
|
|
150
160
|
//! Creates a collation in the catalog
|
|
151
|
-
DUCKDB_API CatalogEntry *CreateCollation(
|
|
161
|
+
DUCKDB_API CatalogEntry *CreateCollation(CatalogTransaction transaction, SchemaCatalogEntry *schema,
|
|
152
162
|
CreateCollationInfo *info);
|
|
153
163
|
|
|
154
164
|
//! Drops an entry from the catalog
|
|
@@ -158,6 +168,12 @@ public:
|
|
|
158
168
|
DUCKDB_API SchemaCatalogEntry *GetSchema(ClientContext &context, const string &name = DEFAULT_SCHEMA,
|
|
159
169
|
bool if_exists = false,
|
|
160
170
|
QueryErrorContext error_context = QueryErrorContext());
|
|
171
|
+
DUCKDB_API SchemaCatalogEntry *GetSchema(CatalogTransaction transaction, const string &schema_name,
|
|
172
|
+
bool if_exists = false,
|
|
173
|
+
QueryErrorContext error_context = QueryErrorContext());
|
|
174
|
+
DUCKDB_API static SchemaCatalogEntry *GetSchema(ClientContext &context, const string &catalog_name,
|
|
175
|
+
const string &schema_name, bool if_exists = false,
|
|
176
|
+
QueryErrorContext error_context = QueryErrorContext());
|
|
161
177
|
//! Scans all the schemas in the system one-by-one, invoking the callback for each entry
|
|
162
178
|
DUCKDB_API void ScanSchemas(ClientContext &context, std::function<void(CatalogEntry *)> callback);
|
|
163
179
|
//! Gets the "schema.name" entry of the specified type, if if_exists=true returns nullptr if entry does not
|
|
@@ -165,16 +181,28 @@ public:
|
|
|
165
181
|
DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, CatalogType type, const string &schema,
|
|
166
182
|
const string &name, bool if_exists = false,
|
|
167
183
|
QueryErrorContext error_context = QueryErrorContext());
|
|
184
|
+
//! Gets the "catalog.schema.name" entry of the specified type, if if_exists=true returns nullptr if entry does not
|
|
185
|
+
//! exist, otherwise an exception is thrown
|
|
186
|
+
DUCKDB_API static CatalogEntry *GetEntry(ClientContext &context, CatalogType type, const string &catalog,
|
|
187
|
+
const string &schema, const string &name, bool if_exists = false,
|
|
188
|
+
QueryErrorContext error_context = QueryErrorContext());
|
|
168
189
|
|
|
169
190
|
//! Gets the "schema.name" entry without a specified type, if entry does not exist an exception is thrown
|
|
170
191
|
DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, const string &schema, const string &name);
|
|
171
192
|
|
|
172
193
|
//! Fetches a logical type from the catalog
|
|
173
|
-
DUCKDB_API LogicalType GetType(ClientContext &context, const string &
|
|
194
|
+
DUCKDB_API static LogicalType GetType(ClientContext &context, const string &catalog_name, const string &schema,
|
|
195
|
+
const string &name);
|
|
174
196
|
|
|
175
197
|
template <class T>
|
|
176
198
|
T *GetEntry(ClientContext &context, const string &schema_name, const string &name, bool if_exists = false,
|
|
177
|
-
QueryErrorContext error_context = QueryErrorContext())
|
|
199
|
+
QueryErrorContext error_context = QueryErrorContext()) {
|
|
200
|
+
auto entry = GetEntry(context, T::Type, schema_name, name, if_exists, error_context);
|
|
201
|
+
if (entry && entry->type != T::Type) {
|
|
202
|
+
throw CatalogException(error_context.FormatError("%s is not an %s", name, T::Name));
|
|
203
|
+
}
|
|
204
|
+
return (T *)entry;
|
|
205
|
+
}
|
|
178
206
|
|
|
179
207
|
//! Append a scalar or aggregate function to the catalog
|
|
180
208
|
DUCKDB_API CatalogEntry *AddFunction(ClientContext &context, CreateFunctionInfo *info);
|
|
@@ -182,54 +210,47 @@ public:
|
|
|
182
210
|
//! Alter an existing entry in the catalog.
|
|
183
211
|
DUCKDB_API void Alter(ClientContext &context, AlterInfo *info);
|
|
184
212
|
|
|
213
|
+
public:
|
|
214
|
+
template <class T>
|
|
215
|
+
static T *GetEntry(ClientContext &context, const string &catalog_name, const string &schema_name,
|
|
216
|
+
const string &name, bool if_exists = false,
|
|
217
|
+
QueryErrorContext error_context = QueryErrorContext()) {
|
|
218
|
+
auto entry = GetEntry(context, T::Type, catalog_name, schema_name, name, if_exists, error_context);
|
|
219
|
+
if (entry && entry->type != T::Type) {
|
|
220
|
+
throw CatalogException(error_context.FormatError("%s is not an %s", name, T::Name));
|
|
221
|
+
}
|
|
222
|
+
return (T *)entry;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
DUCKDB_API static vector<SchemaCatalogEntry *> GetSchemas(ClientContext &context, const string &catalog_name);
|
|
226
|
+
DUCKDB_API static vector<SchemaCatalogEntry *> GetAllSchemas(ClientContext &context);
|
|
227
|
+
|
|
228
|
+
DUCKDB_API void Verify();
|
|
229
|
+
|
|
185
230
|
private:
|
|
186
|
-
//!
|
|
187
|
-
|
|
231
|
+
//! Reference to the database
|
|
232
|
+
AttachedDatabase &db;
|
|
188
233
|
|
|
189
234
|
private:
|
|
190
|
-
|
|
235
|
+
CatalogEntryLookup LookupEntryInternal(CatalogTransaction transaction, CatalogType type, const string &schema,
|
|
236
|
+
const string &name);
|
|
191
237
|
CatalogEntryLookup LookupEntry(ClientContext &context, CatalogType type, const string &schema, const string &name,
|
|
192
238
|
bool if_exists = false, QueryErrorContext error_context = QueryErrorContext());
|
|
239
|
+
static CatalogEntryLookup LookupEntry(ClientContext &context, vector<CatalogLookup> &lookups, CatalogType type,
|
|
240
|
+
const string &name, bool if_exists = false,
|
|
241
|
+
QueryErrorContext error_context = QueryErrorContext());
|
|
193
242
|
|
|
194
243
|
//! Return an exception with did-you-mean suggestion.
|
|
195
|
-
CatalogException CreateMissingEntryException(ClientContext &context, const string &entry_name,
|
|
196
|
-
|
|
197
|
-
|
|
244
|
+
static CatalogException CreateMissingEntryException(ClientContext &context, const string &entry_name,
|
|
245
|
+
CatalogType type,
|
|
246
|
+
const unordered_set<SchemaCatalogEntry *> &schemas,
|
|
247
|
+
QueryErrorContext error_context);
|
|
198
248
|
|
|
199
249
|
//! Return the close entry name, the distance and the belonging schema.
|
|
200
|
-
SimilarCatalogEntry SimilarEntryInSchemas(ClientContext &context, const string &entry_name, CatalogType type,
|
|
201
|
-
|
|
250
|
+
static SimilarCatalogEntry SimilarEntryInSchemas(ClientContext &context, const string &entry_name, CatalogType type,
|
|
251
|
+
const unordered_set<SchemaCatalogEntry *> &schemas);
|
|
202
252
|
|
|
203
253
|
void DropSchema(ClientContext &context, DropInfo *info);
|
|
204
254
|
};
|
|
205
255
|
|
|
206
|
-
template <>
|
|
207
|
-
DUCKDB_API TableCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
|
208
|
-
bool if_exists, QueryErrorContext error_context);
|
|
209
|
-
template <>
|
|
210
|
-
DUCKDB_API SequenceCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
211
|
-
const string &name, bool if_exists, QueryErrorContext error_context);
|
|
212
|
-
template <>
|
|
213
|
-
DUCKDB_API TableFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
214
|
-
const string &name, bool if_exists,
|
|
215
|
-
QueryErrorContext error_context);
|
|
216
|
-
template <>
|
|
217
|
-
DUCKDB_API CopyFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
218
|
-
const string &name, bool if_exists,
|
|
219
|
-
QueryErrorContext error_context);
|
|
220
|
-
template <>
|
|
221
|
-
DUCKDB_API PragmaFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
222
|
-
const string &name, bool if_exists,
|
|
223
|
-
QueryErrorContext error_context);
|
|
224
|
-
template <>
|
|
225
|
-
DUCKDB_API AggregateFunctionCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name,
|
|
226
|
-
const string &name, bool if_exists,
|
|
227
|
-
QueryErrorContext error_context);
|
|
228
|
-
template <>
|
|
229
|
-
DUCKDB_API CollateCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
|
230
|
-
bool if_exists, QueryErrorContext error_context);
|
|
231
|
-
template <>
|
|
232
|
-
DUCKDB_API TypeCatalogEntry *Catalog::GetEntry(ClientContext &context, const string &schema_name, const string &name,
|
|
233
|
-
bool if_exists, QueryErrorContext error_context);
|
|
234
|
-
|
|
235
256
|
} // namespace duckdb
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp
CHANGED
|
@@ -17,6 +17,10 @@ namespace duckdb {
|
|
|
17
17
|
|
|
18
18
|
//! An aggregate function in the catalog
|
|
19
19
|
class AggregateFunctionCatalogEntry : public StandardEntry {
|
|
20
|
+
public:
|
|
21
|
+
static constexpr const CatalogType Type = CatalogType::AGGREGATE_FUNCTION_ENTRY;
|
|
22
|
+
static constexpr const char *Name = "aggregate function";
|
|
23
|
+
|
|
20
24
|
public:
|
|
21
25
|
AggregateFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateAggregateFunctionInfo *info)
|
|
22
26
|
: StandardEntry(CatalogType::AGGREGATE_FUNCTION_ENTRY, schema, catalog, info->name),
|
|
@@ -16,6 +16,10 @@ namespace duckdb {
|
|
|
16
16
|
|
|
17
17
|
//! A collation catalog entry
|
|
18
18
|
class CollateCatalogEntry : public StandardEntry {
|
|
19
|
+
public:
|
|
20
|
+
static constexpr const CatalogType Type = CatalogType::COLLATION_ENTRY;
|
|
21
|
+
static constexpr const char *Name = "collation";
|
|
22
|
+
|
|
19
23
|
public:
|
|
20
24
|
CollateCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateCollationInfo *info)
|
|
21
25
|
: StandardEntry(CatalogType::COLLATION_ENTRY, schema, catalog, info->name), function(info->function),
|
|
@@ -19,6 +19,10 @@ struct CreateCopyFunctionInfo;
|
|
|
19
19
|
|
|
20
20
|
//! A table function in the catalog
|
|
21
21
|
class CopyFunctionCatalogEntry : public StandardEntry {
|
|
22
|
+
public:
|
|
23
|
+
static constexpr const CatalogType Type = CatalogType::COPY_FUNCTION_ENTRY;
|
|
24
|
+
static constexpr const char *Name = "copy function";
|
|
25
|
+
|
|
22
26
|
public:
|
|
23
27
|
CopyFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateCopyFunctionInfo *info);
|
|
24
28
|
|
|
@@ -19,6 +19,10 @@ class Index;
|
|
|
19
19
|
|
|
20
20
|
//! An index catalog entry
|
|
21
21
|
class IndexCatalogEntry : public StandardEntry {
|
|
22
|
+
public:
|
|
23
|
+
static constexpr const CatalogType Type = CatalogType::INDEX_ENTRY;
|
|
24
|
+
static constexpr const char *Name = "index";
|
|
25
|
+
|
|
22
26
|
public:
|
|
23
27
|
//! Create an IndexCatalogEntry and initialize storage for it
|
|
24
28
|
IndexCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateIndexInfo *info);
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp
CHANGED
|
@@ -19,6 +19,10 @@ struct CreatePragmaFunctionInfo;
|
|
|
19
19
|
|
|
20
20
|
//! A table function in the catalog
|
|
21
21
|
class PragmaFunctionCatalogEntry : public StandardEntry {
|
|
22
|
+
public:
|
|
23
|
+
static constexpr const CatalogType Type = CatalogType::PRAGMA_FUNCTION_ENTRY;
|
|
24
|
+
static constexpr const char *Name = "pragma function";
|
|
25
|
+
|
|
22
26
|
public:
|
|
23
27
|
PragmaFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreatePragmaFunctionInfo *info);
|
|
24
28
|
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp
CHANGED
|
@@ -17,6 +17,10 @@ namespace duckdb {
|
|
|
17
17
|
|
|
18
18
|
//! A table function in the catalog
|
|
19
19
|
class ScalarFunctionCatalogEntry : public StandardEntry {
|
|
20
|
+
public:
|
|
21
|
+
static constexpr const CatalogType Type = CatalogType::SCALAR_FUNCTION_ENTRY;
|
|
22
|
+
static constexpr const char *Name = "scalar function";
|
|
23
|
+
|
|
20
24
|
public:
|
|
21
25
|
ScalarFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateScalarFunctionInfo *info);
|
|
22
26
|
|
|
@@ -17,6 +17,10 @@ namespace duckdb {
|
|
|
17
17
|
|
|
18
18
|
//! A macro function in the catalog
|
|
19
19
|
class ScalarMacroCatalogEntry : public MacroCatalogEntry {
|
|
20
|
+
public:
|
|
21
|
+
static constexpr const CatalogType Type = CatalogType::MACRO_ENTRY;
|
|
22
|
+
static constexpr const char *Name = "macro function";
|
|
23
|
+
|
|
20
24
|
public:
|
|
21
25
|
ScalarMacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info);
|
|
22
26
|
|
|
@@ -43,6 +43,10 @@ struct DropInfo;
|
|
|
43
43
|
class SchemaCatalogEntry : public CatalogEntry {
|
|
44
44
|
friend class Catalog;
|
|
45
45
|
|
|
46
|
+
public:
|
|
47
|
+
static constexpr const CatalogType Type = CatalogType::SCHEMA_ENTRY;
|
|
48
|
+
static constexpr const char *Name = "schema";
|
|
49
|
+
|
|
46
50
|
public:
|
|
47
51
|
SchemaCatalogEntry(Catalog *catalog, string name, bool is_internal);
|
|
48
52
|
|
|
@@ -67,8 +71,6 @@ private:
|
|
|
67
71
|
CatalogSet types;
|
|
68
72
|
|
|
69
73
|
public:
|
|
70
|
-
static SchemaCatalogEntry *GetTemporaryObjects(ClientContext &context);
|
|
71
|
-
|
|
72
74
|
//! Scan the specified catalog set, invoking the callback method for every entry
|
|
73
75
|
void Scan(ClientContext &context, CatalogType type, const std::function<void(CatalogEntry *)> &callback);
|
|
74
76
|
//! Scan the specified catalog set, invoking the callback method for every committed entry
|
|
@@ -84,25 +86,27 @@ public:
|
|
|
84
86
|
//! Creates an index with the given name in the schema
|
|
85
87
|
CatalogEntry *CreateIndex(ClientContext &context, CreateIndexInfo *info, TableCatalogEntry *table);
|
|
86
88
|
|
|
89
|
+
void Verify(Catalog &catalog) override;
|
|
90
|
+
|
|
87
91
|
private:
|
|
88
92
|
//! Create a scalar or aggregate function within the given schema
|
|
89
|
-
CatalogEntry *CreateFunction(
|
|
93
|
+
CatalogEntry *CreateFunction(CatalogTransaction transaction, CreateFunctionInfo *info);
|
|
90
94
|
//! Creates a table with the given name in the schema
|
|
91
|
-
CatalogEntry *CreateTable(
|
|
95
|
+
CatalogEntry *CreateTable(CatalogTransaction transaction, BoundCreateTableInfo *info);
|
|
92
96
|
//! Creates a view with the given name in the schema
|
|
93
|
-
CatalogEntry *CreateView(
|
|
97
|
+
CatalogEntry *CreateView(CatalogTransaction transaction, CreateViewInfo *info);
|
|
94
98
|
//! Creates a sequence with the given name in the schema
|
|
95
|
-
CatalogEntry *CreateSequence(
|
|
99
|
+
CatalogEntry *CreateSequence(CatalogTransaction transaction, CreateSequenceInfo *info);
|
|
96
100
|
//! Create a table function within the given schema
|
|
97
|
-
CatalogEntry *CreateTableFunction(
|
|
101
|
+
CatalogEntry *CreateTableFunction(CatalogTransaction transaction, CreateTableFunctionInfo *info);
|
|
98
102
|
//! Create a copy function within the given schema
|
|
99
|
-
CatalogEntry *CreateCopyFunction(
|
|
103
|
+
CatalogEntry *CreateCopyFunction(CatalogTransaction transaction, CreateCopyFunctionInfo *info);
|
|
100
104
|
//! Create a pragma function within the given schema
|
|
101
|
-
CatalogEntry *CreatePragmaFunction(
|
|
105
|
+
CatalogEntry *CreatePragmaFunction(CatalogTransaction transaction, CreatePragmaFunctionInfo *info);
|
|
102
106
|
//! Create a collation within the given schema
|
|
103
|
-
CatalogEntry *CreateCollation(
|
|
107
|
+
CatalogEntry *CreateCollation(CatalogTransaction transaction, CreateCollationInfo *info);
|
|
104
108
|
//! Create a enum within the given schema
|
|
105
|
-
CatalogEntry *CreateType(
|
|
109
|
+
CatalogEntry *CreateType(CatalogTransaction transaction, CreateTypeInfo *info);
|
|
106
110
|
|
|
107
111
|
//! Drops an entry from the schema
|
|
108
112
|
void DropEntry(ClientContext &context, DropInfo *info);
|
|
@@ -111,12 +115,15 @@ private:
|
|
|
111
115
|
void Alter(ClientContext &context, AlterInfo *info);
|
|
112
116
|
|
|
113
117
|
//! Add a catalog entry to this schema
|
|
114
|
-
CatalogEntry *AddEntry(
|
|
118
|
+
CatalogEntry *AddEntry(CatalogTransaction transaction, unique_ptr<StandardEntry> entry,
|
|
119
|
+
OnCreateConflict on_conflict);
|
|
115
120
|
//! Add a catalog entry to this schema
|
|
116
|
-
CatalogEntry *AddEntry(
|
|
117
|
-
|
|
121
|
+
CatalogEntry *AddEntry(CatalogTransaction transaction, unique_ptr<StandardEntry> entry,
|
|
122
|
+
OnCreateConflict on_conflict, DependencyList dependencies);
|
|
118
123
|
|
|
119
124
|
//! Get the catalog set for the specified type
|
|
120
125
|
CatalogSet &GetCatalogSet(CatalogType type);
|
|
126
|
+
|
|
127
|
+
CatalogTransaction GetCatalogTransaction(ClientContext &context);
|
|
121
128
|
};
|
|
122
129
|
} // namespace duckdb
|
|
@@ -29,6 +29,10 @@ struct SequenceValue {
|
|
|
29
29
|
|
|
30
30
|
//! A sequence catalog entry
|
|
31
31
|
class SequenceCatalogEntry : public StandardEntry {
|
|
32
|
+
public:
|
|
33
|
+
static constexpr const CatalogType Type = CatalogType::SEQUENCE_ENTRY;
|
|
34
|
+
static constexpr const char *Name = "sequence";
|
|
35
|
+
|
|
32
36
|
public:
|
|
33
37
|
//! Create a real TableCatalogEntry and initialize storage for it
|
|
34
38
|
SequenceCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateSequenceInfo *info);
|
|
@@ -35,6 +35,10 @@ struct DropNotNullInfo;
|
|
|
35
35
|
|
|
36
36
|
//! A table catalog entry
|
|
37
37
|
class TableCatalogEntry : public StandardEntry {
|
|
38
|
+
public:
|
|
39
|
+
static constexpr const CatalogType Type = CatalogType::TABLE_ENTRY;
|
|
40
|
+
static constexpr const char *Name = "table";
|
|
41
|
+
|
|
38
42
|
public:
|
|
39
43
|
//! Create a real TableCatalogEntry and initialize storage for it
|
|
40
44
|
TableCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, BoundCreateTableInfo *info,
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp
CHANGED
|
@@ -22,6 +22,10 @@ struct CreateTableFunctionInfo;
|
|
|
22
22
|
|
|
23
23
|
//! A table function in the catalog
|
|
24
24
|
class TableFunctionCatalogEntry : public StandardEntry {
|
|
25
|
+
public:
|
|
26
|
+
static constexpr const CatalogType Type = CatalogType::TABLE_FUNCTION_ENTRY;
|
|
27
|
+
static constexpr const char *Name = "table function";
|
|
28
|
+
|
|
25
29
|
public:
|
|
26
30
|
TableFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateTableFunctionInfo *info);
|
|
27
31
|
|
|
@@ -16,6 +16,10 @@ namespace duckdb {
|
|
|
16
16
|
|
|
17
17
|
//! A macro function in the catalog
|
|
18
18
|
class TableMacroCatalogEntry : public MacroCatalogEntry {
|
|
19
|
+
public:
|
|
20
|
+
static constexpr const CatalogType Type = CatalogType::TABLE_MACRO_ENTRY;
|
|
21
|
+
static constexpr const char *Name = "table macro function";
|
|
22
|
+
|
|
19
23
|
public:
|
|
20
24
|
TableMacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info);
|
|
21
25
|
|
|
@@ -18,6 +18,10 @@ class Deserializer;
|
|
|
18
18
|
|
|
19
19
|
//! A type catalog entry
|
|
20
20
|
class TypeCatalogEntry : public StandardEntry {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr const CatalogType Type = CatalogType::TYPE_ENTRY;
|
|
23
|
+
static constexpr const char *Name = "type";
|
|
24
|
+
|
|
21
25
|
public:
|
|
22
26
|
//! Create a TypeCatalogEntry and initialize storage for it
|
|
23
27
|
TypeCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateTypeInfo *info);
|
|
@@ -20,6 +20,10 @@ struct CreateViewInfo;
|
|
|
20
20
|
|
|
21
21
|
//! A view catalog entry
|
|
22
22
|
class ViewCatalogEntry : public StandardEntry {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr const CatalogType Type = CatalogType::VIEW_ENTRY;
|
|
25
|
+
static constexpr const char *Name = "view";
|
|
26
|
+
|
|
23
27
|
public:
|
|
24
28
|
//! Create a real TableCatalogEntry and initialize storage for it
|
|
25
29
|
ViewCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateViewInfo *info);
|
|
@@ -18,33 +18,52 @@ namespace duckdb {
|
|
|
18
18
|
|
|
19
19
|
class ClientContext;
|
|
20
20
|
|
|
21
|
+
struct CatalogSearchEntry {
|
|
22
|
+
CatalogSearchEntry(string catalog, string schema);
|
|
23
|
+
|
|
24
|
+
string catalog;
|
|
25
|
+
string schema;
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
string ToString() const;
|
|
29
|
+
static string ListToString(const vector<CatalogSearchEntry> &input);
|
|
30
|
+
static CatalogSearchEntry Parse(const string &input);
|
|
31
|
+
static vector<CatalogSearchEntry> ParseList(const string &input);
|
|
32
|
+
|
|
33
|
+
private:
|
|
34
|
+
static CatalogSearchEntry ParseInternal(const string &input, idx_t &pos);
|
|
35
|
+
static string WriteOptionallyQuoted(const string &input);
|
|
36
|
+
};
|
|
37
|
+
|
|
21
38
|
//! The schema search path, in order by which entries are searched if no schema entry is provided
|
|
22
39
|
class CatalogSearchPath {
|
|
23
40
|
public:
|
|
24
41
|
DUCKDB_API explicit CatalogSearchPath(ClientContext &client_p);
|
|
25
42
|
CatalogSearchPath(const CatalogSearchPath &other) = delete;
|
|
26
43
|
|
|
27
|
-
DUCKDB_API void Set(
|
|
28
|
-
DUCKDB_API void Set(vector<
|
|
44
|
+
DUCKDB_API void Set(CatalogSearchEntry new_value, bool is_set_schema);
|
|
45
|
+
DUCKDB_API void Set(vector<CatalogSearchEntry> new_paths, bool is_set_schema = false);
|
|
29
46
|
DUCKDB_API void Reset();
|
|
30
47
|
|
|
31
|
-
DUCKDB_API const vector<
|
|
32
|
-
DUCKDB_API const vector<
|
|
48
|
+
DUCKDB_API const vector<CatalogSearchEntry> &Get();
|
|
49
|
+
DUCKDB_API const vector<CatalogSearchEntry> &GetSetPaths() {
|
|
33
50
|
return set_paths;
|
|
34
51
|
}
|
|
35
|
-
DUCKDB_API const
|
|
36
|
-
DUCKDB_API
|
|
52
|
+
DUCKDB_API const CatalogSearchEntry &GetDefault();
|
|
53
|
+
DUCKDB_API string GetDefaultSchema(const string &catalog);
|
|
54
|
+
DUCKDB_API string GetDefaultCatalog(const string &schema);
|
|
37
55
|
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
DUCKDB_API vector<string> GetSchemasForCatalog(const string &catalog);
|
|
57
|
+
DUCKDB_API vector<string> GetCatalogsForSchema(const string &schema);
|
|
40
58
|
|
|
41
|
-
|
|
59
|
+
private:
|
|
60
|
+
void SetPaths(vector<CatalogSearchEntry> new_paths);
|
|
42
61
|
|
|
43
62
|
private:
|
|
44
63
|
ClientContext &context;
|
|
45
|
-
vector<
|
|
64
|
+
vector<CatalogSearchEntry> paths;
|
|
46
65
|
//! Only the paths that were explicitly set (minus the always included paths)
|
|
47
|
-
vector<
|
|
66
|
+
vector<CatalogSearchEntry> set_paths;
|
|
48
67
|
};
|
|
49
68
|
|
|
50
69
|
} // namespace duckdb
|