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,106 @@
|
|
|
1
|
+
#include "duckdb/transaction/meta_transaction.hpp"
|
|
2
|
+
#include "duckdb/main/client_context.hpp"
|
|
3
|
+
#include "duckdb/main/attached_database.hpp"
|
|
4
|
+
#include "duckdb/transaction/transaction_manager.hpp"
|
|
5
|
+
|
|
6
|
+
namespace duckdb {
|
|
7
|
+
|
|
8
|
+
MetaTransaction::MetaTransaction(ClientContext &context_p, timestamp_t start_timestamp_p, idx_t catalog_version_p)
|
|
9
|
+
: context(context_p), start_timestamp(start_timestamp_p), catalog_version(catalog_version_p), read_only(true),
|
|
10
|
+
active_query(MAXIMUM_QUERY_ID), modified_database(nullptr) {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
MetaTransaction &MetaTransaction::Get(ClientContext &context) {
|
|
14
|
+
return context.transaction.ActiveTransaction();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ValidChecker &ValidChecker::Get(MetaTransaction &transaction) {
|
|
18
|
+
return transaction.transaction_validity;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Transaction &Transaction::Get(ClientContext &context, AttachedDatabase &db) {
|
|
22
|
+
auto &meta_transaction = MetaTransaction::Get(context);
|
|
23
|
+
return meta_transaction.GetTransaction(&db);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Transaction &MetaTransaction::GetTransaction(AttachedDatabase *db) {
|
|
27
|
+
auto entry = transactions.find(db);
|
|
28
|
+
if (entry == transactions.end()) {
|
|
29
|
+
auto new_transaction = db->GetTransactionManager().StartTransaction(context);
|
|
30
|
+
new_transaction->active_query = active_query;
|
|
31
|
+
all_transactions.push_back(db);
|
|
32
|
+
transactions[db] = new_transaction;
|
|
33
|
+
return *new_transaction;
|
|
34
|
+
} else {
|
|
35
|
+
D_ASSERT(entry->second->active_query == active_query);
|
|
36
|
+
return *entry->second;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Transaction &Transaction::Get(ClientContext &context, Catalog &catalog) {
|
|
41
|
+
return Transaction::Get(context, catalog.GetAttached());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
string MetaTransaction::Commit() {
|
|
45
|
+
string error;
|
|
46
|
+
// commit transactions in reverse order
|
|
47
|
+
for (idx_t i = all_transactions.size(); i > 0; i--) {
|
|
48
|
+
auto db = all_transactions[i - 1];
|
|
49
|
+
auto entry = transactions.find(db);
|
|
50
|
+
if (entry == transactions.end()) {
|
|
51
|
+
throw InternalException("Could not find transaction corresponding to database in MetaTransaction");
|
|
52
|
+
}
|
|
53
|
+
auto &transaction_manager = db->GetTransactionManager();
|
|
54
|
+
auto transaction = entry->second;
|
|
55
|
+
if (error.empty()) {
|
|
56
|
+
// commit
|
|
57
|
+
error = transaction_manager.CommitTransaction(context, transaction);
|
|
58
|
+
} else {
|
|
59
|
+
// we have encountered an error previously - roll back subsequent entries
|
|
60
|
+
transaction_manager.RollbackTransaction(transaction);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return error;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void MetaTransaction::Rollback() {
|
|
67
|
+
// rollback transactions in reverse order
|
|
68
|
+
for (idx_t i = all_transactions.size(); i > 0; i--) {
|
|
69
|
+
auto db = all_transactions[i - 1];
|
|
70
|
+
auto &transaction_manager = db->GetTransactionManager();
|
|
71
|
+
auto entry = transactions.find(db);
|
|
72
|
+
D_ASSERT(entry != transactions.end());
|
|
73
|
+
auto transaction = entry->second;
|
|
74
|
+
transaction_manager.RollbackTransaction(transaction);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
idx_t MetaTransaction::GetActiveQuery() {
|
|
79
|
+
return active_query;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void MetaTransaction::SetActiveQuery(transaction_t query_number) {
|
|
83
|
+
active_query = query_number;
|
|
84
|
+
for (auto &entry : transactions) {
|
|
85
|
+
entry.second->active_query = query_number;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void MetaTransaction::ModifyDatabase(AttachedDatabase *db) {
|
|
90
|
+
if (db->IsSystem() || db->IsTemporary()) {
|
|
91
|
+
// we can always modify the system and temp databases
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!modified_database) {
|
|
95
|
+
modified_database = db;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (db != modified_database) {
|
|
99
|
+
throw TransactionException(
|
|
100
|
+
"Attempting to write to database \"%s\" in a transaction that has already modified database \"%s\" - a "
|
|
101
|
+
"single transaction can only write to a single attached database.",
|
|
102
|
+
db->GetName(), modified_database->GetName());
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
} // namespace duckdb
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include "duckdb/main/config.hpp"
|
|
16
16
|
#include "duckdb/storage/table/column_data.hpp"
|
|
17
17
|
#include "duckdb/main/client_data.hpp"
|
|
18
|
+
#include "duckdb/main/attached_database.hpp"
|
|
18
19
|
|
|
19
20
|
#include <cstring>
|
|
20
21
|
|
|
@@ -27,21 +28,16 @@ TransactionData::TransactionData(transaction_t transaction_id_p, transaction_t s
|
|
|
27
28
|
: transaction(nullptr), transaction_id(transaction_id_p), start_time(start_time_p) {
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
Transaction::Transaction(ClientContext &context_p, transaction_t start_time,
|
|
31
|
-
|
|
32
|
-
: context(context_p.shared_from_this()), start_time(start_time), transaction_id(transaction_id),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
undo_buffer(context.lock()), storage(make_unique<LocalStorage>(context_p, *this)) {
|
|
31
|
+
Transaction::Transaction(TransactionManager &manager_p, ClientContext &context_p, transaction_t start_time,
|
|
32
|
+
transaction_t transaction_id)
|
|
33
|
+
: manager(manager_p), context(context_p.shared_from_this()), start_time(start_time), transaction_id(transaction_id),
|
|
34
|
+
commit_id(0), active_query(MAXIMUM_QUERY_ID), highest_active_query(0), undo_buffer(context_p),
|
|
35
|
+
storage(make_unique<LocalStorage>(context_p, *this)) {
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
Transaction::~Transaction() {
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
Transaction &Transaction::GetTransaction(ClientContext &context) {
|
|
42
|
-
return context.ActiveTransaction();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
41
|
LocalStorage &Transaction::GetLocalStorage() {
|
|
46
42
|
return *storage;
|
|
47
43
|
}
|
|
@@ -96,23 +92,29 @@ bool Transaction::ChangesMade() {
|
|
|
96
92
|
return undo_buffer.ChangesMade() || storage->ChangesMade();
|
|
97
93
|
}
|
|
98
94
|
|
|
99
|
-
bool Transaction::AutomaticCheckpoint(
|
|
100
|
-
auto &storage_manager =
|
|
95
|
+
bool Transaction::AutomaticCheckpoint(AttachedDatabase &db) {
|
|
96
|
+
auto &storage_manager = db.GetStorageManager();
|
|
101
97
|
return storage_manager.AutomaticCheckpoint(storage->EstimatedSize() + undo_buffer.EstimatedSize());
|
|
102
98
|
}
|
|
103
99
|
|
|
104
|
-
string Transaction::Commit(
|
|
100
|
+
string Transaction::Commit(AttachedDatabase &db, transaction_t commit_id, bool checkpoint) noexcept {
|
|
105
101
|
// "checkpoint" parameter indicates if the caller will checkpoint. If checkpoint ==
|
|
106
102
|
// true: Then this function will NOT write to the WAL or flush/persist.
|
|
107
103
|
// This method only makes commit in memory, expecting caller to checkpoint/flush.
|
|
108
104
|
// false: Then this function WILL write to the WAL and Flush/Persist it.
|
|
109
105
|
this->commit_id = commit_id;
|
|
110
|
-
auto &storage_manager = StorageManager::GetStorageManager(db);
|
|
111
|
-
auto log = storage_manager.GetWriteAheadLog();
|
|
112
106
|
|
|
113
107
|
UndoBuffer::IteratorState iterator_state;
|
|
114
108
|
LocalStorage::CommitState commit_state;
|
|
115
|
-
|
|
109
|
+
unique_ptr<StorageCommitState> storage_commit_state;
|
|
110
|
+
WriteAheadLog *log;
|
|
111
|
+
if (!db.IsSystem()) {
|
|
112
|
+
auto &storage_manager = db.GetStorageManager();
|
|
113
|
+
log = storage_manager.GetWriteAheadLog();
|
|
114
|
+
storage_commit_state = storage_manager.GenStorageCommitState(*this, checkpoint);
|
|
115
|
+
} else {
|
|
116
|
+
log = nullptr;
|
|
117
|
+
}
|
|
116
118
|
try {
|
|
117
119
|
storage->Commit(commit_state, *this);
|
|
118
120
|
undo_buffer.Commit(iterator_state, log, commit_id);
|
|
@@ -122,7 +124,9 @@ string Transaction::Commit(DatabaseInstance &db, transaction_t commit_id, bool c
|
|
|
122
124
|
log->WriteSequenceValue(entry.first, entry.second);
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
storage_commit_state
|
|
127
|
+
if (storage_commit_state) {
|
|
128
|
+
storage_commit_state->FlushCommit();
|
|
129
|
+
}
|
|
126
130
|
return string();
|
|
127
131
|
} catch (std::exception &ex) {
|
|
128
132
|
undo_buffer.RevertCommit(iterator_state, transaction_id);
|
|
@@ -139,8 +143,4 @@ void Transaction::Cleanup() {
|
|
|
139
143
|
undo_buffer.Cleanup();
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
ValidChecker &ValidChecker::Get(Transaction &transaction) {
|
|
143
|
-
return transaction.transaction_validity;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
146
|
} // namespace duckdb
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
#include "duckdb/transaction/transaction_context.hpp"
|
|
2
2
|
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
|
4
|
-
#include "duckdb/transaction/
|
|
4
|
+
#include "duckdb/transaction/meta_transaction.hpp"
|
|
5
5
|
#include "duckdb/transaction/transaction_manager.hpp"
|
|
6
|
+
#include "duckdb/main/config.hpp"
|
|
7
|
+
#include "duckdb/main/database_manager.hpp"
|
|
6
8
|
|
|
7
9
|
namespace duckdb {
|
|
8
10
|
|
|
11
|
+
TransactionContext::TransactionContext(ClientContext &context)
|
|
12
|
+
: context(context), auto_commit(true), current_transaction(nullptr) {
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
TransactionContext::~TransactionContext() {
|
|
10
16
|
if (current_transaction) {
|
|
11
17
|
try {
|
|
@@ -19,17 +25,27 @@ void TransactionContext::BeginTransaction() {
|
|
|
19
25
|
if (current_transaction) {
|
|
20
26
|
throw TransactionException("cannot start a transaction within a transaction");
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
auto start_timestamp = Timestamp::GetCurrentTimestamp();
|
|
29
|
+
auto catalog_version = Catalog::GetSystemCatalog(context).GetCatalogVersion();
|
|
30
|
+
current_transaction = make_unique<MetaTransaction>(context, start_timestamp, catalog_version);
|
|
31
|
+
|
|
32
|
+
auto &config = DBConfig::GetConfig(context);
|
|
33
|
+
if (config.options.immediate_transaction_mode) {
|
|
34
|
+
// if immediate transaction mode is enabled then start all transactions immediately
|
|
35
|
+
auto databases = DatabaseManager::Get(context).GetDatabases(context);
|
|
36
|
+
for (auto db : databases) {
|
|
37
|
+
current_transaction->GetTransaction(db);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
23
40
|
}
|
|
24
41
|
|
|
25
42
|
void TransactionContext::Commit() {
|
|
26
43
|
if (!current_transaction) {
|
|
27
44
|
throw TransactionException("failed to commit: no transaction active");
|
|
28
45
|
}
|
|
29
|
-
auto transaction = current_transaction;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
string error = transaction_manager.CommitTransaction(context, transaction);
|
|
46
|
+
auto transaction = move(current_transaction);
|
|
47
|
+
ClearTransaction();
|
|
48
|
+
string error = transaction->Commit();
|
|
33
49
|
if (!error.empty()) {
|
|
34
50
|
throw TransactionException("Failed to commit: %s", error);
|
|
35
51
|
}
|
|
@@ -46,9 +62,9 @@ void TransactionContext::Rollback() {
|
|
|
46
62
|
if (!current_transaction) {
|
|
47
63
|
throw TransactionException("failed to rollback: no transaction active");
|
|
48
64
|
}
|
|
49
|
-
auto transaction = current_transaction;
|
|
65
|
+
auto transaction = move(current_transaction);
|
|
50
66
|
ClearTransaction();
|
|
51
|
-
|
|
67
|
+
transaction->Rollback();
|
|
52
68
|
}
|
|
53
69
|
|
|
54
70
|
void TransactionContext::ClearTransaction() {
|
|
@@ -56,4 +72,24 @@ void TransactionContext::ClearTransaction() {
|
|
|
56
72
|
current_transaction = nullptr;
|
|
57
73
|
}
|
|
58
74
|
|
|
75
|
+
idx_t TransactionContext::GetActiveQuery() {
|
|
76
|
+
if (!current_transaction) {
|
|
77
|
+
throw InternalException("GetActiveQuery called without active transaction");
|
|
78
|
+
}
|
|
79
|
+
return current_transaction->GetActiveQuery();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void TransactionContext::ResetActiveQuery() {
|
|
83
|
+
if (current_transaction) {
|
|
84
|
+
SetActiveQuery(MAXIMUM_QUERY_ID);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void TransactionContext::SetActiveQuery(transaction_t query_number) {
|
|
89
|
+
if (!current_transaction) {
|
|
90
|
+
throw InternalException("SetActiveQuery called without active transaction");
|
|
91
|
+
}
|
|
92
|
+
current_transaction->SetActiveQuery(query_number);
|
|
93
|
+
}
|
|
94
|
+
|
|
59
95
|
} // namespace duckdb
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
#include "duckdb/transaction/transaction.hpp"
|
|
11
11
|
#include "duckdb/main/client_context.hpp"
|
|
12
12
|
#include "duckdb/main/connection_manager.hpp"
|
|
13
|
+
#include "duckdb/main/attached_database.hpp"
|
|
14
|
+
#include "duckdb/main/database_manager.hpp"
|
|
13
15
|
|
|
14
16
|
namespace duckdb {
|
|
15
17
|
|
|
@@ -38,16 +40,14 @@ struct CheckpointLock {
|
|
|
38
40
|
}
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
TransactionManager::TransactionManager(
|
|
42
|
-
// start timestamp starts at
|
|
43
|
-
current_start_timestamp =
|
|
43
|
+
TransactionManager::TransactionManager(AttachedDatabase &db) : db(db), thread_is_checkpointing(false) {
|
|
44
|
+
// start timestamp starts at two
|
|
45
|
+
current_start_timestamp = 2;
|
|
44
46
|
// transaction ID starts very high:
|
|
45
47
|
// it should be much higher than the current start timestamp
|
|
46
48
|
// if transaction_id < start_timestamp for any set of active transactions
|
|
47
49
|
// uncommited data could be read by
|
|
48
50
|
current_transaction_id = TRANSACTION_ID_START;
|
|
49
|
-
// the current active query id
|
|
50
|
-
current_query_number = 1;
|
|
51
51
|
lowest_active_id = TRANSACTION_ID_START;
|
|
52
52
|
lowest_active_start = MAX_TRANSACTION_ID;
|
|
53
53
|
}
|
|
@@ -66,16 +66,13 @@ Transaction *TransactionManager::StartTransaction(ClientContext &context) {
|
|
|
66
66
|
// obtain the start time and transaction ID of this transaction
|
|
67
67
|
transaction_t start_time = current_start_timestamp++;
|
|
68
68
|
transaction_t transaction_id = current_transaction_id++;
|
|
69
|
-
timestamp_t start_timestamp = Timestamp::GetCurrentTimestamp();
|
|
70
69
|
if (active_transactions.empty()) {
|
|
71
70
|
lowest_active_start = start_time;
|
|
72
71
|
lowest_active_id = transaction_id;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
// create the actual transaction
|
|
76
|
-
auto
|
|
77
|
-
auto transaction =
|
|
78
|
-
make_unique<Transaction>(context, start_time, transaction_id, start_timestamp, catalog.GetCatalogVersion());
|
|
75
|
+
auto transaction = make_unique<Transaction>(*this, context, start_time, transaction_id);
|
|
79
76
|
auto transaction_ptr = transaction.get();
|
|
80
77
|
|
|
81
78
|
// store it in the set of active transactions
|
|
@@ -106,19 +103,19 @@ void TransactionManager::LockClients(vector<ClientLockWrapper> &client_locks, Cl
|
|
|
106
103
|
}
|
|
107
104
|
|
|
108
105
|
void TransactionManager::Checkpoint(ClientContext &context, bool force) {
|
|
109
|
-
auto &storage_manager =
|
|
106
|
+
auto &storage_manager = db.GetStorageManager();
|
|
110
107
|
if (storage_manager.InMemory()) {
|
|
111
108
|
return;
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
// first check if no other thread is checkpointing right now
|
|
115
|
-
auto lock =
|
|
112
|
+
auto lock = unique_lock<mutex>(transaction_lock);
|
|
116
113
|
if (thread_is_checkpointing) {
|
|
117
114
|
throw TransactionException("Cannot CHECKPOINT: another thread is checkpointing right now");
|
|
118
115
|
}
|
|
119
116
|
CheckpointLock checkpoint_lock(*this);
|
|
120
117
|
checkpoint_lock.Lock();
|
|
121
|
-
lock.
|
|
118
|
+
lock.unlock();
|
|
122
119
|
|
|
123
120
|
// lock all the clients AND the connection manager now
|
|
124
121
|
// this ensures no new queries can be started, and no new connections to the database can be made
|
|
@@ -126,8 +123,8 @@ void TransactionManager::Checkpoint(ClientContext &context, bool force) {
|
|
|
126
123
|
vector<ClientLockWrapper> client_locks;
|
|
127
124
|
LockClients(client_locks, context);
|
|
128
125
|
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
auto current = &Transaction::Get(context, db);
|
|
127
|
+
lock.lock();
|
|
131
128
|
if (current->ChangesMade()) {
|
|
132
129
|
throw TransactionException("Cannot CHECKPOINT: the current transaction has transaction local changes");
|
|
133
130
|
}
|
|
@@ -155,12 +152,14 @@ void TransactionManager::Checkpoint(ClientContext &context, bool force) {
|
|
|
155
152
|
D_ASSERT(CanCheckpoint(nullptr));
|
|
156
153
|
}
|
|
157
154
|
}
|
|
158
|
-
|
|
159
|
-
storage.CreateCheckpoint();
|
|
155
|
+
storage_manager.CreateCheckpoint();
|
|
160
156
|
}
|
|
161
157
|
|
|
162
158
|
bool TransactionManager::CanCheckpoint(Transaction *current) {
|
|
163
|
-
|
|
159
|
+
if (db.IsSystem()) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
auto &storage_manager = db.GetStorageManager();
|
|
164
163
|
if (storage_manager.InMemory()) {
|
|
165
164
|
return false;
|
|
166
165
|
}
|
|
@@ -223,7 +222,7 @@ string TransactionManager::CommitTransaction(ClientContext &context, Transaction
|
|
|
223
222
|
// checkpoint
|
|
224
223
|
if (checkpoint) {
|
|
225
224
|
// checkpoint the database to disk
|
|
226
|
-
auto &storage_manager =
|
|
225
|
+
auto &storage_manager = db.GetStorageManager();
|
|
227
226
|
storage_manager.CreateCheckpoint(false, true);
|
|
228
227
|
}
|
|
229
228
|
return error;
|
|
@@ -264,6 +263,7 @@ void TransactionManager::RemoveTransaction(Transaction *transaction) noexcept {
|
|
|
264
263
|
transaction_t lowest_stored_query = lowest_start_time;
|
|
265
264
|
D_ASSERT(t_index != active_transactions.size());
|
|
266
265
|
auto current_transaction = move(active_transactions[t_index]);
|
|
266
|
+
auto current_query = DatabaseManager::Get(db).ActiveQueryNumber();
|
|
267
267
|
if (transaction->commit_id != 0) {
|
|
268
268
|
// the transaction was committed, add it to the list of recently
|
|
269
269
|
// committed transactions
|
|
@@ -271,7 +271,7 @@ void TransactionManager::RemoveTransaction(Transaction *transaction) noexcept {
|
|
|
271
271
|
} else {
|
|
272
272
|
// the transaction was aborted, but we might still need its information
|
|
273
273
|
// add it to the set of transactions awaiting GC
|
|
274
|
-
current_transaction->highest_active_query =
|
|
274
|
+
current_transaction->highest_active_query = current_query;
|
|
275
275
|
old_transactions.push_back(move(current_transaction));
|
|
276
276
|
}
|
|
277
277
|
// remove the transaction from the set of currently active transactions
|
|
@@ -296,7 +296,7 @@ void TransactionManager::RemoveTransaction(Transaction *transaction) noexcept {
|
|
|
296
296
|
// when all the currently active scans have finished running...)
|
|
297
297
|
recently_committed_transactions[i]->Cleanup();
|
|
298
298
|
// store the current highest active query
|
|
299
|
-
recently_committed_transactions[i]->highest_active_query =
|
|
299
|
+
recently_committed_transactions[i]->highest_active_query = current_query;
|
|
300
300
|
// move it to the list of transactions awaiting GC
|
|
301
301
|
old_transactions.push_back(move(recently_committed_transactions[i]));
|
|
302
302
|
} else {
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
namespace duckdb {
|
|
17
17
|
constexpr uint32_t UNDO_ENTRY_HEADER_SIZE = sizeof(UndoFlags) + sizeof(uint32_t);
|
|
18
18
|
|
|
19
|
-
UndoBuffer::UndoBuffer(
|
|
20
|
-
: context(*context_p), allocator(BufferAllocator::Get(*context_p)) {
|
|
21
|
-
D_ASSERT(context_p);
|
|
19
|
+
UndoBuffer::UndoBuffer(ClientContext &context_p) : context(context_p), allocator(BufferAllocator::Get(context_p)) {
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
data_ptr_t UndoBuffer::CreateEntry(UndoFlags type, idx_t len) {
|
|
@@ -1326,6 +1326,7 @@ typedef enum PGObjectType {
|
|
|
1326
1326
|
*/
|
|
1327
1327
|
typedef struct PGCreateSchemaStmt {
|
|
1328
1328
|
PGNodeTag type;
|
|
1329
|
+
char *catalogname; /* the name of the catalog in which to create the schema */
|
|
1329
1330
|
char *schemaname; /* the name of the schema to create */
|
|
1330
1331
|
PGList *schemaElts; /* schema components (list of parsenodes) */
|
|
1331
1332
|
PGOnCreateConflict onconflict; /* what to do on create conflict */
|
|
@@ -1895,6 +1896,7 @@ typedef struct PGCreateTableAsStmt {
|
|
|
1895
1896
|
typedef struct PGCheckPointStmt {
|
|
1896
1897
|
PGNodeTag type;
|
|
1897
1898
|
bool force;
|
|
1899
|
+
char *name;
|
|
1898
1900
|
} PGCheckPointStmt;
|
|
1899
1901
|
|
|
1900
1902
|
/* ----------------------
|
|
@@ -1963,6 +1965,7 @@ typedef struct PGCallStmt {
|
|
|
1963
1965
|
|
|
1964
1966
|
typedef struct PGExportStmt {
|
|
1965
1967
|
PGNodeTag type;
|
|
1968
|
+
char *database; /* database name */
|
|
1966
1969
|
char *filename; /* filename */
|
|
1967
1970
|
PGList *options; /* PGList of PGDefElem nodes */
|
|
1968
1971
|
} PGExportStmt;
|
|
@@ -2046,13 +2049,36 @@ typedef struct PGCreateTypeStmt
|
|
|
2046
2049
|
{
|
|
2047
2050
|
PGNodeTag type;
|
|
2048
2051
|
PGNewTypeKind kind;
|
|
2049
|
-
|
|
2052
|
+
PGRangeVar *typeName; /* qualified name (list of Value strings) */
|
|
2050
2053
|
PGList *vals; /* enum values (list of Value strings) */
|
|
2051
2054
|
PGTypeName *ofType; /* original type of alias name */
|
|
2052
2055
|
PGNode *query;
|
|
2053
2056
|
} PGCreateTypeStmt;
|
|
2054
2057
|
|
|
2058
|
+
/* ----------------------
|
|
2059
|
+
* Attach Statement
|
|
2060
|
+
* ----------------------
|
|
2061
|
+
*/
|
|
2062
|
+
|
|
2063
|
+
typedef struct PGAttachStmt
|
|
2064
|
+
{
|
|
2065
|
+
PGNodeTag type;
|
|
2066
|
+
char *path; /* The file path of the to-be-attached database */
|
|
2067
|
+
char *name; /* The name of the attached database */
|
|
2068
|
+
PGList *options; /* PGList of PGDefElem nodes */
|
|
2069
|
+
PGNode *query;
|
|
2070
|
+
} PGAttachStmt;
|
|
2071
|
+
|
|
2055
2072
|
|
|
2073
|
+
/* ----------------------
|
|
2074
|
+
* Use Statement
|
|
2075
|
+
* ----------------------
|
|
2076
|
+
*/
|
|
2077
|
+
|
|
2078
|
+
typedef struct PGUseStmt {
|
|
2079
|
+
PGNodeTag type;
|
|
2080
|
+
PGRangeVar *name; /* variable to be set */
|
|
2081
|
+
} PGUseStmt;
|
|
2056
2082
|
|
|
2057
2083
|
|
|
2058
2084
|
|