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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#include "duckdb/function/built_in_functions.hpp"
|
|
2
|
+
#include "duckdb/parser/parsed_data/create_aggregate_function_info.hpp"
|
|
3
|
+
#include "duckdb/parser/parsed_data/create_collation_info.hpp"
|
|
4
|
+
#include "duckdb/parser/parsed_data/create_copy_function_info.hpp"
|
|
5
|
+
#include "duckdb/parser/parsed_data/create_pragma_function_info.hpp"
|
|
6
|
+
#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp"
|
|
7
|
+
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"
|
|
8
|
+
#include "duckdb/catalog/catalog.hpp"
|
|
9
|
+
#include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp"
|
|
10
|
+
|
|
11
|
+
namespace duckdb {
|
|
12
|
+
|
|
13
|
+
BuiltinFunctions::BuiltinFunctions(CatalogTransaction transaction, Catalog &catalog)
|
|
14
|
+
: transaction(transaction), catalog(catalog) {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
BuiltinFunctions::~BuiltinFunctions() {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void BuiltinFunctions::AddCollation(string name, ScalarFunction function, bool combinable,
|
|
21
|
+
bool not_required_for_equality) {
|
|
22
|
+
CreateCollationInfo info(move(name), move(function), combinable, not_required_for_equality);
|
|
23
|
+
info.internal = true;
|
|
24
|
+
catalog.CreateCollation(transaction, &info);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void BuiltinFunctions::AddFunction(AggregateFunctionSet set) {
|
|
28
|
+
CreateAggregateFunctionInfo info(move(set));
|
|
29
|
+
info.internal = true;
|
|
30
|
+
catalog.CreateFunction(transaction, &info);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void BuiltinFunctions::AddFunction(AggregateFunction function) {
|
|
34
|
+
CreateAggregateFunctionInfo info(move(function));
|
|
35
|
+
info.internal = true;
|
|
36
|
+
catalog.CreateFunction(transaction, &info);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void BuiltinFunctions::AddFunction(PragmaFunction function) {
|
|
40
|
+
CreatePragmaFunctionInfo info(move(function));
|
|
41
|
+
info.internal = true;
|
|
42
|
+
catalog.CreatePragmaFunction(transaction, &info);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void BuiltinFunctions::AddFunction(const string &name, PragmaFunctionSet functions) {
|
|
46
|
+
CreatePragmaFunctionInfo info(name, move(functions));
|
|
47
|
+
info.internal = true;
|
|
48
|
+
catalog.CreatePragmaFunction(transaction, &info);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void BuiltinFunctions::AddFunction(ScalarFunction function) {
|
|
52
|
+
CreateScalarFunctionInfo info(move(function));
|
|
53
|
+
info.internal = true;
|
|
54
|
+
catalog.CreateFunction(transaction, &info);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void BuiltinFunctions::AddFunction(const vector<string> &names, ScalarFunction function) { // NOLINT: false positive
|
|
58
|
+
for (auto &name : names) {
|
|
59
|
+
function.name = name;
|
|
60
|
+
AddFunction(function);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
void BuiltinFunctions::AddFunction(ScalarFunctionSet set) {
|
|
65
|
+
CreateScalarFunctionInfo info(move(set));
|
|
66
|
+
info.internal = true;
|
|
67
|
+
catalog.CreateFunction(transaction, &info);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void BuiltinFunctions::AddFunction(TableFunction function) {
|
|
71
|
+
CreateTableFunctionInfo info(move(function));
|
|
72
|
+
info.internal = true;
|
|
73
|
+
catalog.CreateTableFunction(transaction, &info);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
void BuiltinFunctions::AddFunction(TableFunctionSet set) {
|
|
77
|
+
CreateTableFunctionInfo info(move(set));
|
|
78
|
+
info.internal = true;
|
|
79
|
+
catalog.CreateTableFunction(transaction, &info);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void BuiltinFunctions::AddFunction(CopyFunction function) {
|
|
83
|
+
CreateCopyFunctionInfo info(move(function));
|
|
84
|
+
info.internal = true;
|
|
85
|
+
catalog.CreateCopyFunction(transaction, &info);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
} // namespace duckdb
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
#include "duckdb/function/function.hpp"
|
|
2
2
|
|
|
3
|
-
#include "duckdb/catalog/catalog.hpp"
|
|
4
|
-
#include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp"
|
|
5
3
|
#include "duckdb/common/string_util.hpp"
|
|
6
4
|
#include "duckdb/common/types/hash.hpp"
|
|
7
5
|
#include "duckdb/function/scalar/string_functions.hpp"
|
|
8
6
|
#include "duckdb/function/scalar_function.hpp"
|
|
9
|
-
#include "duckdb/parser/parsed_data/create_aggregate_function_info.hpp"
|
|
10
|
-
#include "duckdb/parser/parsed_data/create_collation_info.hpp"
|
|
11
|
-
#include "duckdb/parser/parsed_data/create_copy_function_info.hpp"
|
|
12
|
-
#include "duckdb/parser/parsed_data/create_pragma_function_info.hpp"
|
|
13
|
-
#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp"
|
|
14
|
-
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"
|
|
15
7
|
#include "duckdb/parser/parsed_data/pragma_info.hpp"
|
|
16
8
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
|
17
9
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
|
@@ -124,77 +116,6 @@ void BuiltinFunctions::Initialize() {
|
|
|
124
116
|
AddCollation("nfc", NFCNormalizeFun::GetFunction());
|
|
125
117
|
}
|
|
126
118
|
|
|
127
|
-
BuiltinFunctions::BuiltinFunctions(ClientContext &context, Catalog &catalog) : context(context), catalog(catalog) {
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
void BuiltinFunctions::AddCollation(string name, ScalarFunction function, bool combinable,
|
|
131
|
-
bool not_required_for_equality) {
|
|
132
|
-
CreateCollationInfo info(move(name), move(function), combinable, not_required_for_equality);
|
|
133
|
-
info.internal = true;
|
|
134
|
-
catalog.CreateCollation(context, &info);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
void BuiltinFunctions::AddFunction(AggregateFunctionSet set) {
|
|
138
|
-
CreateAggregateFunctionInfo info(move(set));
|
|
139
|
-
info.internal = true;
|
|
140
|
-
catalog.CreateFunction(context, &info);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
void BuiltinFunctions::AddFunction(AggregateFunction function) {
|
|
144
|
-
CreateAggregateFunctionInfo info(move(function));
|
|
145
|
-
info.internal = true;
|
|
146
|
-
catalog.CreateFunction(context, &info);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
void BuiltinFunctions::AddFunction(PragmaFunction function) {
|
|
150
|
-
CreatePragmaFunctionInfo info(move(function));
|
|
151
|
-
info.internal = true;
|
|
152
|
-
catalog.CreatePragmaFunction(context, &info);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
void BuiltinFunctions::AddFunction(const string &name, PragmaFunctionSet functions) {
|
|
156
|
-
CreatePragmaFunctionInfo info(name, move(functions));
|
|
157
|
-
info.internal = true;
|
|
158
|
-
catalog.CreatePragmaFunction(context, &info);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
void BuiltinFunctions::AddFunction(ScalarFunction function) {
|
|
162
|
-
CreateScalarFunctionInfo info(move(function));
|
|
163
|
-
info.internal = true;
|
|
164
|
-
catalog.CreateFunction(context, &info);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
void BuiltinFunctions::AddFunction(const vector<string> &names, ScalarFunction function) { // NOLINT: false positive
|
|
168
|
-
for (auto &name : names) {
|
|
169
|
-
function.name = name;
|
|
170
|
-
AddFunction(function);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
void BuiltinFunctions::AddFunction(ScalarFunctionSet set) {
|
|
175
|
-
CreateScalarFunctionInfo info(move(set));
|
|
176
|
-
info.internal = true;
|
|
177
|
-
catalog.CreateFunction(context, &info);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
void BuiltinFunctions::AddFunction(TableFunction function) {
|
|
181
|
-
CreateTableFunctionInfo info(move(function));
|
|
182
|
-
info.internal = true;
|
|
183
|
-
catalog.CreateTableFunction(context, &info);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
void BuiltinFunctions::AddFunction(TableFunctionSet set) {
|
|
187
|
-
CreateTableFunctionInfo info(move(set));
|
|
188
|
-
info.internal = true;
|
|
189
|
-
catalog.CreateTableFunction(context, &info);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
void BuiltinFunctions::AddFunction(CopyFunction function) {
|
|
193
|
-
CreateCopyFunctionInfo info(move(function));
|
|
194
|
-
info.internal = true;
|
|
195
|
-
catalog.CreateCopyFunction(context, &info);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
119
|
hash_t BaseScalarFunction::Hash() const {
|
|
199
120
|
hash_t hash = return_type.Hash();
|
|
200
121
|
for (auto &arg : arguments) {
|
|
@@ -247,7 +247,8 @@ unique_ptr<Expression> FunctionBinder::BindScalarFunction(const string &schema,
|
|
|
247
247
|
vector<unique_ptr<Expression>> children, string &error,
|
|
248
248
|
bool is_operator, Binder *binder) {
|
|
249
249
|
// bind the function
|
|
250
|
-
auto function =
|
|
250
|
+
auto function =
|
|
251
|
+
Catalog::GetSystemCatalog(context).GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, schema, name);
|
|
251
252
|
D_ASSERT(function && function->type == CatalogType::SCALAR_FUNCTION_ENTRY);
|
|
252
253
|
return BindScalarFunction((ScalarFunctionCatalogEntry &)*function, move(children), error, is_operator, binder);
|
|
253
254
|
}
|
|
@@ -28,6 +28,10 @@ string PragmaShowTablesExpanded(ClientContext &context, const FunctionParameters
|
|
|
28
28
|
)";
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
string PragmaShowDatabases(ClientContext &context, const FunctionParameters ¶meters) {
|
|
32
|
+
return "SELECT name FROM pragma_database_list() ORDER BY name;";
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
string PragmaAllProfiling(ClientContext &context, const FunctionParameters ¶meters) {
|
|
32
36
|
return "SELECT * FROM pragma_last_profiling_output() JOIN pragma_detailed_profiling_output() ON "
|
|
33
37
|
"(pragma_last_profiling_output.operator_id);";
|
|
@@ -42,7 +46,11 @@ string PragmaCollations(ClientContext &context, const FunctionParameters ¶me
|
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
string PragmaFunctionsQuery(ClientContext &context, const FunctionParameters ¶meters) {
|
|
45
|
-
return "SELECT
|
|
49
|
+
return "SELECT function_name AS name, upper(function_type) AS type, parameter_types AS parameters, varargs, "
|
|
50
|
+
"return_type, has_side_effects AS side_effects"
|
|
51
|
+
" FROM duckdb_functions()"
|
|
52
|
+
" WHERE function_type IN ('scalar', 'aggregate')"
|
|
53
|
+
" ORDER BY 1;";
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
string PragmaShow(ClientContext &context, const FunctionParameters ¶meters) {
|
|
@@ -94,6 +102,7 @@ void PragmaQueries::RegisterFunction(BuiltinFunctions &set) {
|
|
|
94
102
|
set.AddFunction(PragmaFunction::PragmaCall("storage_info", PragmaStorageInfo, {LogicalType::VARCHAR}));
|
|
95
103
|
set.AddFunction(PragmaFunction::PragmaStatement("show_tables", PragmaShowTables));
|
|
96
104
|
set.AddFunction(PragmaFunction::PragmaStatement("show_tables_expanded", PragmaShowTablesExpanded));
|
|
105
|
+
set.AddFunction(PragmaFunction::PragmaStatement("show_databases", PragmaShowDatabases));
|
|
97
106
|
set.AddFunction(PragmaFunction::PragmaStatement("database_list", PragmaDatabaseList));
|
|
98
107
|
set.AddFunction(PragmaFunction::PragmaStatement("collations", PragmaCollations));
|
|
99
108
|
set.AddFunction(PragmaFunction::PragmaCall("show", PragmaShow, {LogicalType::VARCHAR}));
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
|
6
6
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
|
7
7
|
#include "duckdb/main/client_context.hpp"
|
|
8
|
-
#include "duckdb/transaction/
|
|
8
|
+
#include "duckdb/transaction/meta_transaction.hpp"
|
|
9
9
|
|
|
10
10
|
namespace duckdb {
|
|
11
11
|
|
|
12
12
|
static timestamp_t GetTransactionTimestamp(ExpressionState &state) {
|
|
13
|
-
return state.GetContext()
|
|
13
|
+
return MetaTransaction::Get(state.GetContext()).start_timestamp;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
static void CurrentTimeFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
@@ -417,8 +417,9 @@ static unique_ptr<FunctionData> ListAggregatesBind(ClientContext &context, Scala
|
|
|
417
417
|
|
|
418
418
|
// look up the aggregate function in the catalog
|
|
419
419
|
QueryErrorContext error_context(nullptr, 0);
|
|
420
|
-
auto func =
|
|
421
|
-
|
|
420
|
+
auto func =
|
|
421
|
+
(AggregateFunctionCatalogEntry *)Catalog::GetSystemCatalog(context).GetEntry<AggregateFunctionCatalogEntry>(
|
|
422
|
+
context, DEFAULT_SCHEMA, function_name, false, error_context);
|
|
422
423
|
D_ASSERT(func->type == CatalogType::AGGREGATE_FUNCTION_ENTRY);
|
|
423
424
|
|
|
424
425
|
if (is_parameter) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#include "duckdb/function/scalar/sequence_functions.hpp"
|
|
2
2
|
|
|
3
3
|
#include "duckdb/catalog/catalog.hpp"
|
|
4
|
+
#include "duckdb/catalog/dependency_list.hpp"
|
|
4
5
|
#include "duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp"
|
|
5
6
|
#include "duckdb/common/exception.hpp"
|
|
6
7
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
#include "duckdb/transaction/transaction.hpp"
|
|
10
11
|
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
|
11
12
|
#include "duckdb/common/operator/add.hpp"
|
|
13
|
+
#include "duckdb/planner/binder.hpp"
|
|
12
14
|
|
|
13
15
|
namespace duckdb {
|
|
14
16
|
|
|
@@ -74,14 +76,12 @@ struct NextSequenceValueOperator {
|
|
|
74
76
|
}
|
|
75
77
|
};
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Transaction &transaction;
|
|
84
|
-
};
|
|
79
|
+
SequenceCatalogEntry *BindSequence(ClientContext &context, const string &name) {
|
|
80
|
+
auto qname = QualifiedName::Parse(name);
|
|
81
|
+
// fetch the sequence from the catalog
|
|
82
|
+
Binder::BindSchemaOrCatalog(context, qname.catalog, qname.schema);
|
|
83
|
+
return Catalog::GetEntry<SequenceCatalogEntry>(context, qname.catalog, qname.schema, qname.name);
|
|
84
|
+
}
|
|
85
85
|
|
|
86
86
|
template <class OP>
|
|
87
87
|
static void NextValFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
@@ -90,8 +90,8 @@ static void NextValFunction(DataChunk &args, ExpressionState &state, Vector &res
|
|
|
90
90
|
auto &input = args.data[0];
|
|
91
91
|
|
|
92
92
|
auto &context = state.GetContext();
|
|
93
|
-
auto &transaction = Transaction::GetTransaction(context);
|
|
94
93
|
if (info.sequence) {
|
|
94
|
+
auto &transaction = Transaction::Get(context, *info.sequence->catalog);
|
|
95
95
|
// sequence to use is hard coded
|
|
96
96
|
// increment the sequence
|
|
97
97
|
result.SetVectorType(VectorType::FLAT_VECTOR);
|
|
@@ -101,14 +101,12 @@ static void NextValFunction(DataChunk &args, ExpressionState &state, Vector &res
|
|
|
101
101
|
result_data[i] = OP::Operation(transaction, info.sequence);
|
|
102
102
|
}
|
|
103
103
|
} else {
|
|
104
|
-
NextValData next_val_input(info, transaction);
|
|
105
104
|
// sequence to use comes from the input
|
|
106
105
|
UnaryExecutor::Execute<string_t, int64_t>(input, result, args.size(), [&](string_t value) {
|
|
107
|
-
auto qname = QualifiedName::Parse(value.GetString());
|
|
108
106
|
// fetch the sequence from the catalog
|
|
109
|
-
auto sequence =
|
|
110
|
-
Catalog::GetCatalog(context).GetEntry<SequenceCatalogEntry>(context, qname.schema, qname.name);
|
|
107
|
+
auto sequence = BindSequence(context, value.GetString());
|
|
111
108
|
// finally get the next value from the sequence
|
|
109
|
+
auto &transaction = Transaction::Get(context, *sequence->catalog);
|
|
112
110
|
return OP::Operation(transaction, sequence);
|
|
113
111
|
});
|
|
114
112
|
}
|
|
@@ -122,17 +120,16 @@ static unique_ptr<FunctionData> NextValBind(ClientContext &context, ScalarFuncti
|
|
|
122
120
|
// evaluate the constant and perform the catalog lookup already
|
|
123
121
|
auto seqname = ExpressionExecutor::EvaluateScalar(context, *arguments[0]);
|
|
124
122
|
if (!seqname.IsNull()) {
|
|
125
|
-
|
|
126
|
-
sequence = Catalog::GetCatalog(context).GetEntry<SequenceCatalogEntry>(context, qname.schema, qname.name);
|
|
123
|
+
sequence = BindSequence(context, seqname.ToString());
|
|
127
124
|
}
|
|
128
125
|
}
|
|
129
126
|
return make_unique<NextvalBindData>(sequence);
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
static void NextValDependency(BoundFunctionExpression &expr,
|
|
129
|
+
static void NextValDependency(BoundFunctionExpression &expr, DependencyList &dependencies) {
|
|
133
130
|
auto &info = (NextvalBindData &)*expr.bind_info;
|
|
134
131
|
if (info.sequence) {
|
|
135
|
-
dependencies.
|
|
132
|
+
dependencies.AddDependency(info.sequence);
|
|
136
133
|
}
|
|
137
134
|
}
|
|
138
135
|
|
|
@@ -199,8 +199,8 @@ static unique_ptr<FunctionData> BindAggregateState(ClientContext &context, Scala
|
|
|
199
199
|
auto state_type = AggregateStateType::GetStateType(arg_return_type);
|
|
200
200
|
|
|
201
201
|
// now we can look up the function in the catalog again and bind it
|
|
202
|
-
auto func = Catalog::
|
|
203
|
-
|
|
202
|
+
auto func = Catalog::GetSystemCatalog(context).GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, DEFAULT_SCHEMA,
|
|
203
|
+
state_type.function_name);
|
|
204
204
|
if (func->type != CatalogType::AGGREGATE_FUNCTION_ENTRY) {
|
|
205
205
|
throw InternalException("Could not find aggregate %s", state_type.function_name);
|
|
206
206
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
|
7
7
|
#include "duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp"
|
|
8
8
|
#include "duckdb/transaction/transaction.hpp"
|
|
9
|
+
#include "duckdb/main/database_manager.hpp"
|
|
9
10
|
|
|
10
11
|
namespace duckdb {
|
|
11
12
|
|
|
@@ -17,7 +18,7 @@ static void CurrentQueryFunction(DataChunk &input, ExpressionState &state, Vecto
|
|
|
17
18
|
|
|
18
19
|
// current_schema
|
|
19
20
|
static void CurrentSchemaFunction(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
20
|
-
Value val(ClientData::Get(state.GetContext()).catalog_search_path->GetDefault());
|
|
21
|
+
Value val(ClientData::Get(state.GetContext()).catalog_search_path->GetDefault().schema);
|
|
21
22
|
result.Reference(val);
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -34,9 +35,9 @@ static void CurrentSchemasFunction(DataChunk &input, ExpressionState &state, Vec
|
|
|
34
35
|
auto implicit_schemas = *ConstantVector::GetData<bool>(input.data[0]);
|
|
35
36
|
vector<Value> schema_list;
|
|
36
37
|
auto &catalog_search_path = ClientData::Get(state.GetContext()).catalog_search_path;
|
|
37
|
-
|
|
38
|
+
auto &search_path = implicit_schemas ? catalog_search_path->Get() : catalog_search_path->GetSetPaths();
|
|
38
39
|
std::transform(search_path.begin(), search_path.end(), std::back_inserter(schema_list),
|
|
39
|
-
[](const
|
|
40
|
+
[](const CatalogSearchEntry &s) -> Value { return Value(s.schema); });
|
|
40
41
|
|
|
41
42
|
auto val = Value::LIST(LogicalType::VARCHAR, schema_list);
|
|
42
43
|
result.Reference(val);
|
|
@@ -44,7 +45,9 @@ static void CurrentSchemasFunction(DataChunk &input, ExpressionState &state, Vec
|
|
|
44
45
|
|
|
45
46
|
// txid_current
|
|
46
47
|
static void TransactionIdCurrent(DataChunk &input, ExpressionState &state, Vector &result) {
|
|
47
|
-
auto &
|
|
48
|
+
auto &context = state.GetContext();
|
|
49
|
+
auto &catalog = Catalog::GetCatalog(context, DatabaseManager::GetDefaultDatabase(context));
|
|
50
|
+
auto &transaction = Transaction::Get(context, catalog);
|
|
48
51
|
auto val = Value::BIGINT(transaction.start_time);
|
|
49
52
|
result.Reference(val);
|
|
50
53
|
}
|
|
@@ -2,26 +2,59 @@
|
|
|
2
2
|
#include "duckdb/main/client_context.hpp"
|
|
3
3
|
#include "duckdb/storage/storage_manager.hpp"
|
|
4
4
|
#include "duckdb/transaction/transaction_manager.hpp"
|
|
5
|
+
#include "duckdb/main/database_manager.hpp"
|
|
5
6
|
|
|
6
7
|
namespace duckdb {
|
|
7
8
|
|
|
9
|
+
struct CheckpointBindData : public FunctionData {
|
|
10
|
+
explicit CheckpointBindData(AttachedDatabase *db) : db(db) {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
AttachedDatabase *db;
|
|
14
|
+
|
|
15
|
+
public:
|
|
16
|
+
unique_ptr<FunctionData> Copy() const override {
|
|
17
|
+
return make_unique<CheckpointBindData>(db);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
bool Equals(const FunctionData &other_p) const override {
|
|
21
|
+
auto &other = (const CheckpointBindData &)other_p;
|
|
22
|
+
return db == other.db;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
8
26
|
static unique_ptr<FunctionData> CheckpointBind(ClientContext &context, TableFunctionBindInput &input,
|
|
9
27
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
10
28
|
return_types.emplace_back(LogicalType::BOOLEAN);
|
|
11
29
|
names.emplace_back("Success");
|
|
12
|
-
|
|
30
|
+
|
|
31
|
+
AttachedDatabase *db;
|
|
32
|
+
auto &db_manager = DatabaseManager::Get(context);
|
|
33
|
+
if (!input.inputs.empty()) {
|
|
34
|
+
db = db_manager.GetDatabase(context, StringValue::Get(input.inputs[0]));
|
|
35
|
+
} else {
|
|
36
|
+
db = db_manager.GetDatabase(context, DatabaseManager::GetDefaultDatabase(context));
|
|
37
|
+
}
|
|
38
|
+
return make_unique<CheckpointBindData>(db);
|
|
13
39
|
}
|
|
14
40
|
|
|
15
41
|
template <bool FORCE>
|
|
16
42
|
static void TemplatedCheckpointFunction(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
|
|
17
|
-
auto &
|
|
43
|
+
auto &bind_data = (CheckpointBindData &)*data_p.bind_data;
|
|
44
|
+
auto &transaction_manager = TransactionManager::Get(*bind_data.db);
|
|
18
45
|
transaction_manager.Checkpoint(context, FORCE);
|
|
19
46
|
}
|
|
20
47
|
|
|
21
48
|
void CheckpointFunction::RegisterFunction(BuiltinFunctions &set) {
|
|
22
|
-
|
|
49
|
+
TableFunctionSet checkpoint("checkpoint");
|
|
50
|
+
checkpoint.AddFunction(TableFunction({}, TemplatedCheckpointFunction<false>, CheckpointBind));
|
|
51
|
+
checkpoint.AddFunction(TableFunction({LogicalType::VARCHAR}, TemplatedCheckpointFunction<false>, CheckpointBind));
|
|
23
52
|
set.AddFunction(checkpoint);
|
|
24
|
-
|
|
53
|
+
|
|
54
|
+
TableFunctionSet force_checkpoint("force_checkpoint");
|
|
55
|
+
force_checkpoint.AddFunction(TableFunction({}, TemplatedCheckpointFunction<true>, CheckpointBind));
|
|
56
|
+
force_checkpoint.AddFunction(
|
|
57
|
+
TableFunction({LogicalType::VARCHAR}, TemplatedCheckpointFunction<true>, CheckpointBind));
|
|
25
58
|
set.AddFunction(force_checkpoint);
|
|
26
59
|
}
|
|
27
60
|
|
|
@@ -899,7 +899,7 @@ unique_ptr<TableFunctionRef> ReadCSVReplacement(ClientContext &context, const st
|
|
|
899
899
|
void BuiltinFunctions::RegisterReadFunctions() {
|
|
900
900
|
CSVCopyFunction::RegisterFunction(*this);
|
|
901
901
|
ReadCSVTableFunction::RegisterFunction(*this);
|
|
902
|
-
auto &config = DBConfig::GetConfig(
|
|
902
|
+
auto &config = DBConfig::GetConfig(*transaction.db);
|
|
903
903
|
config.replacement_scans.emplace_back(ReadCSVReplacement);
|
|
904
904
|
}
|
|
905
905
|
|
|
@@ -23,18 +23,24 @@ struct DuckDBColumnsData : public GlobalTableFunctionState {
|
|
|
23
23
|
|
|
24
24
|
static unique_ptr<FunctionData> DuckDBColumnsBind(ClientContext &context, TableFunctionBindInput &input,
|
|
25
25
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
26
|
-
names.emplace_back("
|
|
26
|
+
names.emplace_back("database_name");
|
|
27
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
28
|
+
|
|
29
|
+
names.emplace_back("database_oid");
|
|
27
30
|
return_types.emplace_back(LogicalType::BIGINT);
|
|
28
31
|
|
|
29
32
|
names.emplace_back("schema_name");
|
|
30
33
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
31
34
|
|
|
32
|
-
names.emplace_back("
|
|
35
|
+
names.emplace_back("schema_oid");
|
|
33
36
|
return_types.emplace_back(LogicalType::BIGINT);
|
|
34
37
|
|
|
35
38
|
names.emplace_back("table_name");
|
|
36
39
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
37
40
|
|
|
41
|
+
names.emplace_back("table_oid");
|
|
42
|
+
return_types.emplace_back(LogicalType::BIGINT);
|
|
43
|
+
|
|
38
44
|
names.emplace_back("column_name");
|
|
39
45
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
40
46
|
|
|
@@ -75,14 +81,10 @@ unique_ptr<GlobalTableFunctionState> DuckDBColumnsInit(ClientContext &context, T
|
|
|
75
81
|
auto result = make_unique<DuckDBColumnsData>();
|
|
76
82
|
|
|
77
83
|
// scan all the schemas for tables and views and collect them
|
|
78
|
-
auto schemas = Catalog::
|
|
84
|
+
auto schemas = Catalog::GetAllSchemas(context);
|
|
79
85
|
for (auto &schema : schemas) {
|
|
80
86
|
schema->Scan(context, CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
81
87
|
}
|
|
82
|
-
|
|
83
|
-
// check the temp schema as well
|
|
84
|
-
SchemaCatalogEntry::GetTemporaryObjects(context)->Scan(
|
|
85
|
-
context, CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
86
88
|
return move(result);
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -186,36 +188,41 @@ void ColumnHelper::WriteColumns(idx_t start_index, idx_t start_col, idx_t end_co
|
|
|
186
188
|
auto index = start_index + (i - start_col);
|
|
187
189
|
auto &entry = *Entry();
|
|
188
190
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
idx_t col = 0;
|
|
192
|
+
// database_name, VARCHAR
|
|
193
|
+
output.SetValue(col++, index, entry.catalog->GetName());
|
|
194
|
+
// database_oid, BIGINT
|
|
195
|
+
output.SetValue(col++, index, Value::BIGINT(entry.catalog->GetOid()));
|
|
191
196
|
// schema_name, VARCHAR
|
|
192
|
-
output.SetValue(
|
|
193
|
-
//
|
|
194
|
-
output.SetValue(
|
|
197
|
+
output.SetValue(col++, index, entry.schema->name);
|
|
198
|
+
// schema_oid, BIGINT
|
|
199
|
+
output.SetValue(col++, index, Value::BIGINT(entry.schema->oid));
|
|
195
200
|
// table_name, VARCHAR
|
|
196
|
-
output.SetValue(
|
|
201
|
+
output.SetValue(col++, index, entry.name);
|
|
202
|
+
// table_oid, BIGINT
|
|
203
|
+
output.SetValue(col++, index, Value::BIGINT(entry.oid));
|
|
197
204
|
// column_name, VARCHAR
|
|
198
|
-
output.SetValue(
|
|
205
|
+
output.SetValue(col++, index, Value(ColumnName(i)));
|
|
199
206
|
// column_index, INTEGER
|
|
200
|
-
output.SetValue(
|
|
207
|
+
output.SetValue(col++, index, Value::INTEGER(i + 1));
|
|
201
208
|
// internal, BOOLEAN
|
|
202
|
-
output.SetValue(
|
|
209
|
+
output.SetValue(col++, index, Value::BOOLEAN(entry.internal));
|
|
203
210
|
// column_default, VARCHAR
|
|
204
|
-
output.SetValue(
|
|
211
|
+
output.SetValue(col++, index, Value(ColumnDefault(i)));
|
|
205
212
|
// is_nullable, BOOLEAN
|
|
206
|
-
output.SetValue(
|
|
213
|
+
output.SetValue(col++, index, Value::BOOLEAN(IsNullable(i)));
|
|
207
214
|
// data_type, VARCHAR
|
|
208
215
|
const LogicalType &type = ColumnType(i);
|
|
209
|
-
output.SetValue(
|
|
216
|
+
output.SetValue(col++, index, Value(type.ToString()));
|
|
210
217
|
// data_type_id, BIGINT
|
|
211
|
-
output.SetValue(
|
|
218
|
+
output.SetValue(col++, index, Value::BIGINT(int(type.id())));
|
|
212
219
|
if (type == LogicalType::VARCHAR) {
|
|
213
220
|
// FIXME: need check constraints in place to set this correctly
|
|
214
221
|
// character_maximum_length, INTEGER
|
|
215
|
-
output.SetValue(
|
|
222
|
+
output.SetValue(col++, index, Value());
|
|
216
223
|
} else {
|
|
217
224
|
// "character_maximum_length", PhysicalType::INTEGER
|
|
218
|
-
output.SetValue(
|
|
225
|
+
output.SetValue(col++, index, Value());
|
|
219
226
|
}
|
|
220
227
|
|
|
221
228
|
Value numeric_precision, numeric_scale, numeric_precision_radix;
|
|
@@ -268,11 +275,11 @@ void ColumnHelper::WriteColumns(idx_t start_index, idx_t start_col, idx_t end_co
|
|
|
268
275
|
}
|
|
269
276
|
|
|
270
277
|
// numeric_precision, INTEGER
|
|
271
|
-
output.SetValue(
|
|
278
|
+
output.SetValue(col++, index, numeric_precision);
|
|
272
279
|
// numeric_precision_radix, INTEGER
|
|
273
|
-
output.SetValue(
|
|
280
|
+
output.SetValue(col++, index, numeric_precision_radix);
|
|
274
281
|
// numeric_scale, INTEGER
|
|
275
|
-
output.SetValue(
|
|
282
|
+
output.SetValue(col++, index, numeric_scale);
|
|
276
283
|
}
|
|
277
284
|
}
|
|
278
285
|
|