duckdb 0.6.2-dev781.0 → 0.6.2-dev891.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/column_reader.cpp +7 -0
- 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/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
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
|
20
20
|
#include "duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp"
|
|
21
21
|
#include "duckdb/transaction/transaction.hpp"
|
|
22
|
+
#include "duckdb/catalog/catalog_transaction.hpp"
|
|
22
23
|
#include <functional>
|
|
23
24
|
#include <memory>
|
|
24
25
|
|
|
@@ -26,6 +27,7 @@ namespace duckdb {
|
|
|
26
27
|
struct AlterInfo;
|
|
27
28
|
|
|
28
29
|
class ClientContext;
|
|
30
|
+
class DependencyList;
|
|
29
31
|
struct MappingValue;
|
|
30
32
|
struct EntryIndex;
|
|
31
33
|
|
|
@@ -69,23 +71,31 @@ public:
|
|
|
69
71
|
|
|
70
72
|
//! Create an entry in the catalog set. Returns whether or not it was
|
|
71
73
|
//! successful.
|
|
74
|
+
DUCKDB_API bool CreateEntry(CatalogTransaction transaction, const string &name, unique_ptr<CatalogEntry> value,
|
|
75
|
+
DependencyList &dependencies);
|
|
72
76
|
DUCKDB_API bool CreateEntry(ClientContext &context, const string &name, unique_ptr<CatalogEntry> value,
|
|
73
|
-
|
|
77
|
+
DependencyList &dependencies);
|
|
74
78
|
|
|
75
|
-
DUCKDB_API bool AlterEntry(
|
|
79
|
+
DUCKDB_API bool AlterEntry(CatalogTransaction transaction, const string &name, AlterInfo *alter_info);
|
|
76
80
|
|
|
77
|
-
DUCKDB_API bool DropEntry(
|
|
81
|
+
DUCKDB_API bool DropEntry(CatalogTransaction transaction, const string &name, bool cascade,
|
|
82
|
+
bool allow_drop_internal = false);
|
|
83
|
+
DUCKDB_API bool DropEntry(ClientContext &context, const string &name, bool cascade,
|
|
84
|
+
bool allow_drop_internal = false);
|
|
78
85
|
|
|
79
|
-
|
|
86
|
+
DUCKDB_API Catalog &GetCatalog();
|
|
87
|
+
|
|
88
|
+
bool AlterOwnership(CatalogTransaction transaction, ChangeOwnershipInfo *info);
|
|
80
89
|
|
|
81
90
|
void CleanupEntry(CatalogEntry *catalog_entry);
|
|
82
91
|
|
|
83
92
|
//! Returns the entry with the specified name
|
|
93
|
+
DUCKDB_API CatalogEntry *GetEntry(CatalogTransaction transaction, const string &name);
|
|
84
94
|
DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, const string &name);
|
|
85
95
|
|
|
86
96
|
//! Gets the entry that is most similar to the given name (i.e. smallest levenshtein distance), or empty string if
|
|
87
97
|
//! none is found. The returned pair consists of the entry name and the distance (smaller means closer).
|
|
88
|
-
pair<string, idx_t> SimilarEntry(
|
|
98
|
+
pair<string, idx_t> SimilarEntry(CatalogTransaction transaction, const string &name);
|
|
89
99
|
|
|
90
100
|
//! Rollback <entry> to be the currently valid entry for a certain catalog
|
|
91
101
|
//! entry
|
|
@@ -94,20 +104,23 @@ public:
|
|
|
94
104
|
//! Scan the catalog set, invoking the callback method for every committed entry
|
|
95
105
|
DUCKDB_API void Scan(const std::function<void(CatalogEntry *)> &callback);
|
|
96
106
|
//! Scan the catalog set, invoking the callback method for every entry
|
|
107
|
+
DUCKDB_API void Scan(CatalogTransaction transaction, const std::function<void(CatalogEntry *)> &callback);
|
|
97
108
|
DUCKDB_API void Scan(ClientContext &context, const std::function<void(CatalogEntry *)> &callback);
|
|
98
109
|
|
|
99
110
|
template <class T>
|
|
100
|
-
vector<T *> GetEntries(
|
|
111
|
+
vector<T *> GetEntries(CatalogTransaction transaction) {
|
|
101
112
|
vector<T *> result;
|
|
102
|
-
Scan(
|
|
113
|
+
Scan(transaction, [&](CatalogEntry *entry) { result.push_back((T *)entry); });
|
|
103
114
|
return result;
|
|
104
115
|
}
|
|
105
116
|
|
|
106
|
-
DUCKDB_API
|
|
107
|
-
DUCKDB_API
|
|
117
|
+
DUCKDB_API bool HasConflict(CatalogTransaction transaction, transaction_t timestamp);
|
|
118
|
+
DUCKDB_API bool UseTimestamp(CatalogTransaction transaction, transaction_t timestamp);
|
|
108
119
|
|
|
109
120
|
void UpdateTimestamp(CatalogEntry *entry, transaction_t timestamp);
|
|
110
121
|
|
|
122
|
+
void Verify(Catalog &catalog);
|
|
123
|
+
|
|
111
124
|
private:
|
|
112
125
|
//! Adjusts table dependencies on the event of an UNDO
|
|
113
126
|
void AdjustTableDependencies(CatalogEntry *entry);
|
|
@@ -116,22 +129,24 @@ private:
|
|
|
116
129
|
//! Adjust User dependency
|
|
117
130
|
void AdjustUserDependency(CatalogEntry *entry, ColumnDefinition &column, bool remove);
|
|
118
131
|
//! Given a root entry, gets the entry valid for this transaction
|
|
119
|
-
CatalogEntry *GetEntryForTransaction(
|
|
132
|
+
CatalogEntry *GetEntryForTransaction(CatalogTransaction transaction, CatalogEntry *current);
|
|
120
133
|
CatalogEntry *GetCommittedEntry(CatalogEntry *current);
|
|
121
|
-
bool GetEntryInternal(
|
|
122
|
-
|
|
134
|
+
bool GetEntryInternal(CatalogTransaction transaction, const string &name, EntryIndex *entry_index,
|
|
135
|
+
CatalogEntry *&entry);
|
|
136
|
+
bool GetEntryInternal(CatalogTransaction transaction, EntryIndex &entry_index, CatalogEntry *&entry);
|
|
123
137
|
//! Drops an entry from the catalog set; must hold the catalog_lock to safely call this
|
|
124
|
-
void DropEntryInternal(
|
|
125
|
-
CatalogEntry *CreateEntryInternal(
|
|
126
|
-
MappingValue *GetMapping(
|
|
127
|
-
void PutMapping(
|
|
128
|
-
void DeleteMapping(
|
|
129
|
-
void DropEntryDependencies(
|
|
138
|
+
void DropEntryInternal(CatalogTransaction transaction, EntryIndex entry_index, CatalogEntry &entry, bool cascade);
|
|
139
|
+
CatalogEntry *CreateEntryInternal(CatalogTransaction transaction, unique_ptr<CatalogEntry> entry);
|
|
140
|
+
MappingValue *GetMapping(CatalogTransaction transaction, const string &name, bool get_latest = false);
|
|
141
|
+
void PutMapping(CatalogTransaction transaction, const string &name, EntryIndex entry_index);
|
|
142
|
+
void DeleteMapping(CatalogTransaction transaction, const string &name);
|
|
143
|
+
void DropEntryDependencies(CatalogTransaction transaction, EntryIndex &entry_index, CatalogEntry &entry,
|
|
144
|
+
bool cascade);
|
|
130
145
|
|
|
131
146
|
//! Create all default entries
|
|
132
|
-
void CreateDefaultEntries(
|
|
147
|
+
void CreateDefaultEntries(CatalogTransaction transaction, unique_lock<mutex> &lock);
|
|
133
148
|
//! Attempt to create a default entry with the specified name. Returns the entry if successful, nullptr otherwise.
|
|
134
|
-
CatalogEntry *CreateDefaultEntry(
|
|
149
|
+
CatalogEntry *CreateDefaultEntry(CatalogTransaction transaction, const string &name, unique_lock<mutex> &lock);
|
|
135
150
|
|
|
136
151
|
EntryIndex PutEntry(idx_t entry_index, unique_ptr<CatalogEntry> entry);
|
|
137
152
|
void PutEntry(EntryIndex index, unique_ptr<CatalogEntry> entry);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
// DuckDB
|
|
3
|
+
//
|
|
4
|
+
// duckdb/catalog/catalog_transaction.hpp
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
//===----------------------------------------------------------------------===//
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include "duckdb/common/common.hpp"
|
|
12
|
+
|
|
13
|
+
namespace duckdb {
|
|
14
|
+
class Catalog;
|
|
15
|
+
class ClientContext;
|
|
16
|
+
class DatabaseInstance;
|
|
17
|
+
class Transaction;
|
|
18
|
+
|
|
19
|
+
struct CatalogTransaction {
|
|
20
|
+
CatalogTransaction(Catalog &catalog, ClientContext &context);
|
|
21
|
+
CatalogTransaction(DatabaseInstance &db, transaction_t transaction_id_p, transaction_t start_time_p);
|
|
22
|
+
|
|
23
|
+
DatabaseInstance *db;
|
|
24
|
+
ClientContext *context;
|
|
25
|
+
Transaction *transaction;
|
|
26
|
+
transaction_t transaction_id;
|
|
27
|
+
transaction_t start_time;
|
|
28
|
+
|
|
29
|
+
ClientContext &GetContext();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
} // namespace duckdb
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
// DuckDB
|
|
3
|
+
//
|
|
4
|
+
// duckdb/catalog/dependency_list.hpp
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
//===----------------------------------------------------------------------===//
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include "duckdb/common/common.hpp"
|
|
12
|
+
#include "duckdb/common/unordered_set.hpp"
|
|
13
|
+
|
|
14
|
+
namespace duckdb {
|
|
15
|
+
class CatalogEntry;
|
|
16
|
+
|
|
17
|
+
//! The DependencyList
|
|
18
|
+
class DependencyList {
|
|
19
|
+
friend class DependencyManager;
|
|
20
|
+
|
|
21
|
+
public:
|
|
22
|
+
DUCKDB_API void AddDependency(CatalogEntry *entry);
|
|
23
|
+
|
|
24
|
+
private:
|
|
25
|
+
unordered_set<CatalogEntry *> set;
|
|
26
|
+
};
|
|
27
|
+
} // namespace duckdb
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
#include "duckdb/catalog/catalog_entry.hpp"
|
|
12
12
|
#include "duckdb/catalog/catalog_set.hpp"
|
|
13
13
|
#include "duckdb/catalog/dependency.hpp"
|
|
14
|
+
#include "duckdb/catalog/catalog_transaction.hpp"
|
|
14
15
|
|
|
15
16
|
#include <functional>
|
|
16
17
|
|
|
17
18
|
namespace duckdb {
|
|
18
19
|
class Catalog;
|
|
19
20
|
class ClientContext;
|
|
21
|
+
class DependencyList;
|
|
20
22
|
|
|
21
23
|
//! The DependencyManager is in charge of managing dependencies between catalog entries
|
|
22
24
|
class DependencyManager {
|
|
@@ -31,7 +33,7 @@ public:
|
|
|
31
33
|
//! Scans all dependencies, returning pairs of (object, dependent)
|
|
32
34
|
void Scan(const std::function<void(CatalogEntry *, CatalogEntry *, DependencyType)> &callback);
|
|
33
35
|
|
|
34
|
-
void AddOwnership(
|
|
36
|
+
void AddOwnership(CatalogTransaction transaction, CatalogEntry *owner, CatalogEntry *entry);
|
|
35
37
|
|
|
36
38
|
private:
|
|
37
39
|
Catalog &catalog;
|
|
@@ -43,9 +45,9 @@ private:
|
|
|
43
45
|
unordered_map<CatalogEntry *, unordered_set<CatalogEntry *>> dependencies_map;
|
|
44
46
|
|
|
45
47
|
private:
|
|
46
|
-
void AddObject(
|
|
47
|
-
void DropObject(
|
|
48
|
-
void AlterObject(
|
|
48
|
+
void AddObject(CatalogTransaction transaction, CatalogEntry *object, DependencyList &dependencies);
|
|
49
|
+
void DropObject(CatalogTransaction transaction, CatalogEntry *object, bool cascade);
|
|
50
|
+
void AlterObject(CatalogTransaction transaction, CatalogEntry *old_obj, CatalogEntry *new_obj);
|
|
49
51
|
void EraseObjectInternal(CatalogEntry *object);
|
|
50
52
|
};
|
|
51
53
|
} // namespace duckdb
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
namespace duckdb {
|
|
14
14
|
class Allocator;
|
|
15
|
+
class AttachedDatabase;
|
|
15
16
|
class ClientContext;
|
|
16
17
|
class DatabaseInstance;
|
|
17
18
|
class ExecutionContext;
|
|
@@ -91,6 +92,7 @@ public:
|
|
|
91
92
|
}
|
|
92
93
|
static Allocator &Get(ClientContext &context);
|
|
93
94
|
static Allocator &Get(DatabaseInstance &db);
|
|
95
|
+
static Allocator &Get(AttachedDatabase &db);
|
|
94
96
|
|
|
95
97
|
PrivateAllocatorData *GetPrivateData() {
|
|
96
98
|
return private_data.get();
|
|
@@ -137,6 +139,7 @@ void DestroyObject(T *ptr) {
|
|
|
137
139
|
struct BufferAllocator {
|
|
138
140
|
DUCKDB_API static Allocator &Get(ClientContext &context);
|
|
139
141
|
DUCKDB_API static Allocator &Get(DatabaseInstance &db);
|
|
142
|
+
DUCKDB_API static Allocator &Get(AttachedDatabase &db);
|
|
140
143
|
};
|
|
141
144
|
|
|
142
145
|
} // namespace duckdb
|
|
@@ -43,9 +43,14 @@ using data_ptr = unique_ptr<char[]>;
|
|
|
43
43
|
using std::make_shared;
|
|
44
44
|
|
|
45
45
|
// NOTE: there is a copy of this in the Postgres' parser grammar (gram.y)
|
|
46
|
-
#define DEFAULT_SCHEMA
|
|
47
|
-
#define
|
|
48
|
-
#define
|
|
46
|
+
#define DEFAULT_SCHEMA "main"
|
|
47
|
+
#define INVALID_SCHEMA ""
|
|
48
|
+
#define INVALID_CATALOG ""
|
|
49
|
+
#define SYSTEM_CATALOG "system"
|
|
50
|
+
#define TEMP_CATALOG "temp"
|
|
51
|
+
|
|
52
|
+
DUCKDB_API bool IsInvalidSchema(const string &str);
|
|
53
|
+
DUCKDB_API bool IsInvalidCatalog(const string &str);
|
|
49
54
|
|
|
50
55
|
//! a saner size_t for loop indices etc
|
|
51
56
|
typedef uint64_t idx_t;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#pragma once
|
|
10
10
|
|
|
11
11
|
#include "duckdb/common/constants.hpp"
|
|
12
|
+
#include "duckdb/common/unordered_set.hpp"
|
|
12
13
|
|
|
13
14
|
namespace duckdb {
|
|
14
15
|
|
|
@@ -41,7 +42,8 @@ enum class StatementType : uint8_t {
|
|
|
41
42
|
LOAD_STATEMENT, // LOAD statement type
|
|
42
43
|
RELATION_STATEMENT,
|
|
43
44
|
EXTENSION_STATEMENT,
|
|
44
|
-
LOGICAL_PLAN_STATEMENT
|
|
45
|
+
LOGICAL_PLAN_STATEMENT,
|
|
46
|
+
ATTACH_STATEMENT
|
|
45
47
|
|
|
46
48
|
};
|
|
47
49
|
|
|
@@ -58,12 +60,12 @@ string StatementReturnTypeToString(StatementReturnType type);
|
|
|
58
60
|
//! A struct containing various properties of a SQL statement
|
|
59
61
|
struct StatementProperties {
|
|
60
62
|
StatementProperties()
|
|
61
|
-
:
|
|
63
|
+
: requires_valid_transaction(true), allow_stream_result(false), bound_all_parameters(true),
|
|
62
64
|
return_type(StatementReturnType::QUERY_RESULT), parameter_count(0) {
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
//!
|
|
66
|
-
|
|
67
|
+
//! The set of databases this statement will modify
|
|
68
|
+
unordered_set<string> modified_databases;
|
|
67
69
|
//! Whether or not the statement requires a valid transaction. Almost all statements require this, with the
|
|
68
70
|
//! exception of
|
|
69
71
|
bool requires_valid_transaction;
|
|
@@ -75,6 +77,10 @@ struct StatementProperties {
|
|
|
75
77
|
StatementReturnType return_type;
|
|
76
78
|
//! The number of prepared statement parameters
|
|
77
79
|
idx_t parameter_count;
|
|
80
|
+
|
|
81
|
+
bool IsReadOnly() {
|
|
82
|
+
return modified_databases.empty();
|
|
83
|
+
}
|
|
78
84
|
};
|
|
79
85
|
|
|
80
86
|
} // namespace duckdb
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
#undef RemoveDirectory
|
|
23
23
|
|
|
24
24
|
namespace duckdb {
|
|
25
|
+
class AttachedDatabase;
|
|
25
26
|
class ClientContext;
|
|
26
27
|
class DatabaseInstance;
|
|
27
28
|
class FileOpener;
|
|
@@ -107,6 +108,7 @@ public:
|
|
|
107
108
|
DUCKDB_API static constexpr FileCompressionType DEFAULT_COMPRESSION = FileCompressionType::UNCOMPRESSED;
|
|
108
109
|
DUCKDB_API static FileSystem &GetFileSystem(ClientContext &context);
|
|
109
110
|
DUCKDB_API static FileSystem &GetFileSystem(DatabaseInstance &db);
|
|
111
|
+
DUCKDB_API static FileSystem &Get(AttachedDatabase &db);
|
|
110
112
|
DUCKDB_API static FileOpener *GetFileOpener(ClientContext &context);
|
|
111
113
|
|
|
112
114
|
DUCKDB_API virtual unique_ptr<FileHandle> OpenFile(const string &path, uint8_t flags,
|
|
@@ -121,6 +121,9 @@ public:
|
|
|
121
121
|
//! Convert a string to lowercase
|
|
122
122
|
DUCKDB_API static string Lower(const string &str);
|
|
123
123
|
|
|
124
|
+
//! Case insensitive equals
|
|
125
|
+
DUCKDB_API static bool CIEquals(const string &l1, const string &l2);
|
|
126
|
+
|
|
124
127
|
//! Format a string using printf semantics
|
|
125
128
|
template <typename... Args>
|
|
126
129
|
static string Format(const string fmt_str, Args... params) {
|
|
@@ -51,14 +51,14 @@ class ART : public Index {
|
|
|
51
51
|
public:
|
|
52
52
|
ART(const vector<column_t> &column_ids, TableIOManager &table_io_manager,
|
|
53
53
|
const vector<unique_ptr<Expression>> &unbound_expressions, IndexConstraintType constraint_type,
|
|
54
|
-
|
|
54
|
+
AttachedDatabase &db, idx_t block_id = DConstants::INVALID_INDEX,
|
|
55
55
|
idx_t block_offset = DConstants::INVALID_INDEX);
|
|
56
56
|
~ART() override;
|
|
57
57
|
|
|
58
58
|
//! Root of the tree
|
|
59
59
|
Node *tree;
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
AttachedDatabase &db;
|
|
62
62
|
|
|
63
63
|
public:
|
|
64
64
|
//! Initialize a scan on the index with the given expression and column ids
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
// DuckDB
|
|
3
|
+
//
|
|
4
|
+
// duckdb/execution/operator/schema/physical_attach.hpp
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
//===----------------------------------------------------------------------===//
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include "duckdb/execution/physical_operator.hpp"
|
|
12
|
+
#include "duckdb/parser/parsed_data/attach_info.hpp"
|
|
13
|
+
|
|
14
|
+
namespace duckdb {
|
|
15
|
+
|
|
16
|
+
//! PhysicalLoad represents an extension LOAD operation
|
|
17
|
+
class PhysicalAttach : public PhysicalOperator {
|
|
18
|
+
public:
|
|
19
|
+
explicit PhysicalAttach(unique_ptr<AttachInfo> info, idx_t estimated_cardinality)
|
|
20
|
+
: PhysicalOperator(PhysicalOperatorType::ATTACH, {LogicalType::BOOLEAN}, estimated_cardinality),
|
|
21
|
+
info(move(info)) {
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
unique_ptr<AttachInfo> info;
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
// Source interface
|
|
28
|
+
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
|
|
29
|
+
void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
|
30
|
+
LocalSourceState &lstate) const override;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
} // namespace duckdb
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include "duckdb/planner/logical_operator.hpp"
|
|
14
14
|
#include "duckdb/planner/logical_tokens.hpp"
|
|
15
15
|
#include "duckdb/planner/operator/logical_limit_percent.hpp"
|
|
16
|
+
#include "duckdb/catalog/dependency_list.hpp"
|
|
16
17
|
#include "duckdb/common/unordered_map.hpp"
|
|
17
18
|
#include "duckdb/common/unordered_set.hpp"
|
|
18
19
|
|
|
@@ -27,7 +28,7 @@ public:
|
|
|
27
28
|
explicit PhysicalPlanGenerator(ClientContext &context);
|
|
28
29
|
~PhysicalPlanGenerator();
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
DependencyList dependencies;
|
|
31
32
|
//! Recursive CTEs require at least one ChunkScan, referencing the working_table.
|
|
32
33
|
//! This data structure is used to establish it.
|
|
33
34
|
unordered_map<idx_t, std::shared_ptr<ColumnDataCollection>> recursive_cte_tables;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
// DuckDB
|
|
3
|
+
//
|
|
4
|
+
// duckdb/function/built_in_functions.hpp
|
|
5
|
+
//
|
|
6
|
+
//
|
|
7
|
+
//===----------------------------------------------------------------------===//
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include "duckdb/function/function.hpp"
|
|
12
|
+
#include "duckdb/catalog/catalog_transaction.hpp"
|
|
13
|
+
|
|
14
|
+
namespace duckdb {
|
|
15
|
+
|
|
16
|
+
class BuiltinFunctions {
|
|
17
|
+
public:
|
|
18
|
+
BuiltinFunctions(CatalogTransaction transaction, Catalog &catalog);
|
|
19
|
+
~BuiltinFunctions();
|
|
20
|
+
|
|
21
|
+
//! Initialize a catalog with all built-in functions
|
|
22
|
+
void Initialize();
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
void AddFunction(AggregateFunctionSet set);
|
|
26
|
+
void AddFunction(AggregateFunction function);
|
|
27
|
+
void AddFunction(ScalarFunctionSet set);
|
|
28
|
+
void AddFunction(PragmaFunction function);
|
|
29
|
+
void AddFunction(const string &name, PragmaFunctionSet functions);
|
|
30
|
+
void AddFunction(ScalarFunction function);
|
|
31
|
+
void AddFunction(const vector<string> &names, ScalarFunction function);
|
|
32
|
+
void AddFunction(TableFunctionSet set);
|
|
33
|
+
void AddFunction(TableFunction function);
|
|
34
|
+
void AddFunction(CopyFunction function);
|
|
35
|
+
|
|
36
|
+
void AddCollation(string name, ScalarFunction function, bool combinable = false,
|
|
37
|
+
bool not_required_for_equality = false);
|
|
38
|
+
|
|
39
|
+
private:
|
|
40
|
+
CatalogTransaction transaction;
|
|
41
|
+
Catalog &catalog;
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
template <class T>
|
|
45
|
+
void Register() {
|
|
46
|
+
T::RegisterFunction(*this);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// table-producing functions
|
|
50
|
+
void RegisterTableScanFunctions();
|
|
51
|
+
void RegisterSQLiteFunctions();
|
|
52
|
+
void RegisterReadFunctions();
|
|
53
|
+
void RegisterTableFunctions();
|
|
54
|
+
void RegisterArrowFunctions();
|
|
55
|
+
|
|
56
|
+
// aggregates
|
|
57
|
+
void RegisterAlgebraicAggregates();
|
|
58
|
+
void RegisterDistributiveAggregates();
|
|
59
|
+
void RegisterNestedAggregates();
|
|
60
|
+
void RegisterHolisticAggregates();
|
|
61
|
+
void RegisterRegressiveAggregates();
|
|
62
|
+
|
|
63
|
+
// scalar functions
|
|
64
|
+
void RegisterDateFunctions();
|
|
65
|
+
void RegisterEnumFunctions();
|
|
66
|
+
void RegisterGenericFunctions();
|
|
67
|
+
void RegisterMathFunctions();
|
|
68
|
+
void RegisterOperators();
|
|
69
|
+
void RegisterStringFunctions();
|
|
70
|
+
void RegisterNestedFunctions();
|
|
71
|
+
void RegisterSequenceFunctions();
|
|
72
|
+
void RegisterTrigonometricsFunctions();
|
|
73
|
+
|
|
74
|
+
// pragmas
|
|
75
|
+
void RegisterPragmaFunctions();
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace duckdb
|
|
@@ -148,65 +148,4 @@ public:
|
|
|
148
148
|
DUCKDB_API string ToString() override;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
-
class BuiltinFunctions {
|
|
152
|
-
public:
|
|
153
|
-
BuiltinFunctions(ClientContext &transaction, Catalog &catalog);
|
|
154
|
-
|
|
155
|
-
//! Initialize a catalog with all built-in functions
|
|
156
|
-
void Initialize();
|
|
157
|
-
|
|
158
|
-
public:
|
|
159
|
-
void AddFunction(AggregateFunctionSet set);
|
|
160
|
-
void AddFunction(AggregateFunction function);
|
|
161
|
-
void AddFunction(ScalarFunctionSet set);
|
|
162
|
-
void AddFunction(PragmaFunction function);
|
|
163
|
-
void AddFunction(const string &name, PragmaFunctionSet functions);
|
|
164
|
-
void AddFunction(ScalarFunction function);
|
|
165
|
-
void AddFunction(const vector<string> &names, ScalarFunction function);
|
|
166
|
-
void AddFunction(TableFunctionSet set);
|
|
167
|
-
void AddFunction(TableFunction function);
|
|
168
|
-
void AddFunction(CopyFunction function);
|
|
169
|
-
|
|
170
|
-
void AddCollation(string name, ScalarFunction function, bool combinable = false,
|
|
171
|
-
bool not_required_for_equality = false);
|
|
172
|
-
|
|
173
|
-
private:
|
|
174
|
-
ClientContext &context;
|
|
175
|
-
Catalog &catalog;
|
|
176
|
-
|
|
177
|
-
private:
|
|
178
|
-
template <class T>
|
|
179
|
-
void Register() {
|
|
180
|
-
T::RegisterFunction(*this);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// table-producing functions
|
|
184
|
-
void RegisterTableScanFunctions();
|
|
185
|
-
void RegisterSQLiteFunctions();
|
|
186
|
-
void RegisterReadFunctions();
|
|
187
|
-
void RegisterTableFunctions();
|
|
188
|
-
void RegisterArrowFunctions();
|
|
189
|
-
|
|
190
|
-
// aggregates
|
|
191
|
-
void RegisterAlgebraicAggregates();
|
|
192
|
-
void RegisterDistributiveAggregates();
|
|
193
|
-
void RegisterNestedAggregates();
|
|
194
|
-
void RegisterHolisticAggregates();
|
|
195
|
-
void RegisterRegressiveAggregates();
|
|
196
|
-
|
|
197
|
-
// scalar functions
|
|
198
|
-
void RegisterDateFunctions();
|
|
199
|
-
void RegisterEnumFunctions();
|
|
200
|
-
void RegisterGenericFunctions();
|
|
201
|
-
void RegisterMathFunctions();
|
|
202
|
-
void RegisterOperators();
|
|
203
|
-
void RegisterStringFunctions();
|
|
204
|
-
void RegisterNestedFunctions();
|
|
205
|
-
void RegisterSequenceFunctions();
|
|
206
|
-
void RegisterTrigonometricsFunctions();
|
|
207
|
-
|
|
208
|
-
// pragmas
|
|
209
|
-
void RegisterPragmaFunctions();
|
|
210
|
-
};
|
|
211
|
-
|
|
212
151
|
} // namespace duckdb
|
|
@@ -47,8 +47,7 @@ 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
|
|
51
|
-
auto func_catalog = catalog.GetEntry(context, type, DEFAULT_SCHEMA, name);
|
|
50
|
+
auto func_catalog = Catalog::GetEntry(context, type, INVALID_CATALOG, DEFAULT_SCHEMA, name);
|
|
52
51
|
if (!func_catalog || func_catalog->type != type) {
|
|
53
52
|
throw InternalException("Cant find catalog entry for function %s", name);
|
|
54
53
|
}
|