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
|
@@ -60,6 +60,12 @@ struct DuckDBConstraintsData : public GlobalTableFunctionState {
|
|
|
60
60
|
|
|
61
61
|
static unique_ptr<FunctionData> DuckDBConstraintsBind(ClientContext &context, TableFunctionBindInput &input,
|
|
62
62
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
63
|
+
names.emplace_back("database_name");
|
|
64
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
65
|
+
|
|
66
|
+
names.emplace_back("database_oid");
|
|
67
|
+
return_types.emplace_back(LogicalType::BIGINT);
|
|
68
|
+
|
|
63
69
|
names.emplace_back("schema_name");
|
|
64
70
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
65
71
|
|
|
@@ -98,13 +104,7 @@ unique_ptr<GlobalTableFunctionState> DuckDBConstraintsInit(ClientContext &contex
|
|
|
98
104
|
auto result = make_unique<DuckDBConstraintsData>();
|
|
99
105
|
|
|
100
106
|
// scan all the schemas for tables and collect them
|
|
101
|
-
auto schemas = Catalog::
|
|
102
|
-
|
|
103
|
-
sort(schemas.begin(), schemas.end(), [&](CatalogEntry *x, CatalogEntry *y) { return (x->name < y->name); });
|
|
104
|
-
|
|
105
|
-
// check the temp schema as well
|
|
106
|
-
auto temp_schema = SchemaCatalogEntry::GetTemporaryObjects(context);
|
|
107
|
-
schemas.push_back(temp_schema);
|
|
107
|
+
auto schemas = Catalog::GetAllSchemas(context);
|
|
108
108
|
|
|
109
109
|
for (auto &schema : schemas) {
|
|
110
110
|
vector<CatalogEntry *> entries;
|
|
@@ -169,16 +169,20 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
|
169
169
|
default:
|
|
170
170
|
throw NotImplementedException("Unimplemented constraint for duckdb_constraints");
|
|
171
171
|
}
|
|
172
|
-
output.SetValue(5, count, Value(constraint_type));
|
|
173
172
|
|
|
173
|
+
idx_t col = 0;
|
|
174
|
+
// database_name, LogicalType::VARCHAR
|
|
175
|
+
output.SetValue(col++, count, Value(table.schema->catalog->GetName()));
|
|
176
|
+
// database_oid, LogicalType::BIGINT
|
|
177
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema->catalog->GetOid()));
|
|
174
178
|
// schema_name, LogicalType::VARCHAR
|
|
175
|
-
output.SetValue(
|
|
179
|
+
output.SetValue(col++, count, Value(table.schema->name));
|
|
176
180
|
// schema_oid, LogicalType::BIGINT
|
|
177
|
-
output.SetValue(
|
|
181
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema->oid));
|
|
178
182
|
// table_name, LogicalType::VARCHAR
|
|
179
|
-
output.SetValue(
|
|
183
|
+
output.SetValue(col++, count, Value(table.name));
|
|
180
184
|
// table_oid, LogicalType::BIGINT
|
|
181
|
-
output.SetValue(
|
|
185
|
+
output.SetValue(col++, count, Value::BIGINT(table.oid));
|
|
182
186
|
|
|
183
187
|
// constraint_index, BIGINT
|
|
184
188
|
auto &bound_constraint = (BoundConstraint &)*table.bound_constraints[data.constraint_offset];
|
|
@@ -193,9 +197,8 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
|
193
197
|
const auto &bound_foreign_key = (const BoundForeignKeyConstraint &)bound_constraint;
|
|
194
198
|
const auto &info = bound_foreign_key.info;
|
|
195
199
|
// find the other table
|
|
196
|
-
auto
|
|
197
|
-
|
|
198
|
-
info.table, true);
|
|
200
|
+
auto table_entry =
|
|
201
|
+
Catalog::GetEntry<TableCatalogEntry>(context, INVALID_CATALOG, info.schema, info.table, true);
|
|
199
202
|
if (!table_entry) {
|
|
200
203
|
throw InternalException("dukdb_constraints: entry %s.%s referenced in foreign key not found",
|
|
201
204
|
info.schema, info.table);
|
|
@@ -212,20 +215,21 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
if (uk_info.columns.empty()) {
|
|
215
|
-
output.SetValue(
|
|
218
|
+
output.SetValue(col++, count, Value::BIGINT(data.unique_constraint_offset++));
|
|
216
219
|
} else {
|
|
217
220
|
auto known_unique_constraint_offset = data.known_fk_unique_constraint_offsets.find(uk_info);
|
|
218
221
|
if (known_unique_constraint_offset == data.known_fk_unique_constraint_offsets.end()) {
|
|
219
222
|
data.known_fk_unique_constraint_offsets.insert(make_pair(uk_info, data.unique_constraint_offset));
|
|
220
|
-
output.SetValue(
|
|
223
|
+
output.SetValue(col++, count, Value::BIGINT(data.unique_constraint_offset));
|
|
221
224
|
data.unique_constraint_offset++;
|
|
222
225
|
} else {
|
|
223
|
-
output.SetValue(
|
|
226
|
+
output.SetValue(col++, count, Value::BIGINT(known_unique_constraint_offset->second));
|
|
224
227
|
}
|
|
225
228
|
}
|
|
229
|
+
output.SetValue(col++, count, Value(constraint_type));
|
|
226
230
|
|
|
227
231
|
// constraint_text, VARCHAR
|
|
228
|
-
output.SetValue(
|
|
232
|
+
output.SetValue(col++, count, Value(constraint->ToString()));
|
|
229
233
|
|
|
230
234
|
// expression, VARCHAR
|
|
231
235
|
Value expression_text;
|
|
@@ -233,7 +237,7 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
|
233
237
|
auto &check = (CheckConstraint &)*constraint;
|
|
234
238
|
expression_text = Value(check.expression->ToString());
|
|
235
239
|
}
|
|
236
|
-
output.SetValue(
|
|
240
|
+
output.SetValue(col++, count, expression_text);
|
|
237
241
|
|
|
238
242
|
vector<LogicalIndex> column_index_list;
|
|
239
243
|
switch (bound_constraint.type) {
|
|
@@ -275,10 +279,10 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
|
275
279
|
}
|
|
276
280
|
|
|
277
281
|
// constraint_column_indexes, LIST
|
|
278
|
-
output.SetValue(
|
|
282
|
+
output.SetValue(col++, count, Value::LIST(move(index_list)));
|
|
279
283
|
|
|
280
284
|
// constraint_column_names, LIST
|
|
281
|
-
output.SetValue(
|
|
285
|
+
output.SetValue(col++, count, Value::LIST(move(column_name_list)));
|
|
282
286
|
|
|
283
287
|
count++;
|
|
284
288
|
}
|
|
@@ -51,7 +51,7 @@ unique_ptr<GlobalTableFunctionState> DuckDBDependenciesInit(ClientContext &conte
|
|
|
51
51
|
auto result = make_unique<DuckDBDependenciesData>();
|
|
52
52
|
|
|
53
53
|
// scan all the schemas and collect them
|
|
54
|
-
auto &catalog = Catalog::GetCatalog(context);
|
|
54
|
+
auto &catalog = Catalog::GetCatalog(context, INVALID_CATALOG);
|
|
55
55
|
auto &dependency_manager = catalog.GetDependencyManager();
|
|
56
56
|
dependency_manager.Scan([&](CatalogEntry *obj, CatalogEntry *dependent, DependencyType type) {
|
|
57
57
|
DependencyInformation info;
|
|
@@ -69,7 +69,7 @@ unique_ptr<GlobalTableFunctionState> DuckDBExtensionsInit(ClientContext &context
|
|
|
69
69
|
info.description = extension.description;
|
|
70
70
|
for (idx_t k = 0; k < alias_count; k++) {
|
|
71
71
|
auto alias = ExtensionHelper::GetExtensionAlias(k);
|
|
72
|
-
if (
|
|
72
|
+
if (info.name == alias.extension) {
|
|
73
73
|
info.aliases.emplace_back(alias.alias);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -28,6 +28,9 @@ struct DuckDBFunctionsData : public GlobalTableFunctionState {
|
|
|
28
28
|
|
|
29
29
|
static unique_ptr<FunctionData> DuckDBFunctionsBind(ClientContext &context, TableFunctionBindInput &input,
|
|
30
30
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
31
|
+
names.emplace_back("database_name");
|
|
32
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
33
|
+
|
|
31
34
|
names.emplace_back("schema_name");
|
|
32
35
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
33
36
|
|
|
@@ -81,11 +84,10 @@ unique_ptr<GlobalTableFunctionState> DuckDBFunctionsInit(ClientContext &context,
|
|
|
81
84
|
auto result = make_unique<DuckDBFunctionsData>();
|
|
82
85
|
|
|
83
86
|
// scan all the schemas for tables and collect themand collect them
|
|
84
|
-
auto schemas = Catalog::
|
|
87
|
+
auto schemas = Catalog::GetAllSchemas(context);
|
|
85
88
|
for (auto &schema : schemas) {
|
|
86
89
|
ExtractFunctionsFromSchema(context, *schema, *result);
|
|
87
90
|
};
|
|
88
|
-
ExtractFunctionsFromSchema(context, *SchemaCatalogEntry::GetTemporaryObjects(context), *result);
|
|
89
91
|
|
|
90
92
|
std::sort(result->entries.begin(), result->entries.end(),
|
|
91
93
|
[&](CatalogEntry *a, CatalogEntry *b) { return (int)a->type < (int)b->type; });
|
|
@@ -420,41 +422,46 @@ struct PragmaFunctionExtractor {
|
|
|
420
422
|
template <class T, class OP>
|
|
421
423
|
bool ExtractFunctionData(StandardEntry *entry, idx_t function_idx, DataChunk &output, idx_t output_offset) {
|
|
422
424
|
auto &function = (T &)*entry;
|
|
425
|
+
idx_t col = 0;
|
|
426
|
+
|
|
427
|
+
// database_name, LogicalType::VARCHAR
|
|
428
|
+
output.SetValue(col++, output_offset, Value(entry->schema->catalog->GetName()));
|
|
429
|
+
|
|
423
430
|
// schema_name, LogicalType::VARCHAR
|
|
424
|
-
output.SetValue(
|
|
431
|
+
output.SetValue(col++, output_offset, Value(entry->schema->name));
|
|
425
432
|
|
|
426
433
|
// function_name, LogicalType::VARCHAR
|
|
427
|
-
output.SetValue(
|
|
434
|
+
output.SetValue(col++, output_offset, Value(entry->name));
|
|
428
435
|
|
|
429
436
|
// function_type, LogicalType::VARCHAR
|
|
430
|
-
output.SetValue(
|
|
437
|
+
output.SetValue(col++, output_offset, Value(OP::GetFunctionType()));
|
|
431
438
|
|
|
432
439
|
// function_description, LogicalType::VARCHAR
|
|
433
|
-
output.SetValue(
|
|
440
|
+
output.SetValue(col++, output_offset, OP::GetFunctionDescription(function, function_idx));
|
|
434
441
|
|
|
435
442
|
// return_type, LogicalType::VARCHAR
|
|
436
|
-
output.SetValue(
|
|
443
|
+
output.SetValue(col++, output_offset, OP::GetReturnType(function, function_idx));
|
|
437
444
|
|
|
438
445
|
// parameters, LogicalType::LIST(LogicalType::VARCHAR)
|
|
439
|
-
output.SetValue(
|
|
446
|
+
output.SetValue(col++, output_offset, OP::GetParameters(function, function_idx));
|
|
440
447
|
|
|
441
448
|
// parameter_types, LogicalType::LIST(LogicalType::VARCHAR)
|
|
442
|
-
output.SetValue(
|
|
449
|
+
output.SetValue(col++, output_offset, OP::GetParameterTypes(function, function_idx));
|
|
443
450
|
|
|
444
451
|
// varargs, LogicalType::VARCHAR
|
|
445
|
-
output.SetValue(
|
|
452
|
+
output.SetValue(col++, output_offset, OP::GetVarArgs(function, function_idx));
|
|
446
453
|
|
|
447
454
|
// macro_definition, LogicalType::VARCHAR
|
|
448
|
-
output.SetValue(
|
|
455
|
+
output.SetValue(col++, output_offset, OP::GetMacroDefinition(function, function_idx));
|
|
449
456
|
|
|
450
457
|
// has_side_effects, LogicalType::BOOLEAN
|
|
451
|
-
output.SetValue(
|
|
458
|
+
output.SetValue(col++, output_offset, OP::HasSideEffects(function, function_idx));
|
|
452
459
|
|
|
453
460
|
// internal, LogicalType::BOOLEAN
|
|
454
|
-
output.SetValue(
|
|
461
|
+
output.SetValue(col++, output_offset, Value::BOOLEAN(entry->internal));
|
|
455
462
|
|
|
456
463
|
// function_oid, LogicalType::BIGINT
|
|
457
|
-
output.SetValue(
|
|
464
|
+
output.SetValue(col++, output_offset, Value::BIGINT(entry->oid));
|
|
458
465
|
|
|
459
466
|
return function_idx + 1 == OP::FunctionCount(function);
|
|
460
467
|
}
|
|
@@ -471,7 +478,7 @@ void DuckDBFunctionsFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
|
471
478
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
|
472
479
|
auto &entry = data.entries[data.offset];
|
|
473
480
|
auto standard_entry = (StandardEntry *)entry;
|
|
474
|
-
bool finished
|
|
481
|
+
bool finished;
|
|
475
482
|
|
|
476
483
|
switch (entry->type) {
|
|
477
484
|
case CatalogType::SCALAR_FUNCTION_ENTRY:
|
|
@@ -20,6 +20,12 @@ struct DuckDBIndexesData : public GlobalTableFunctionState {
|
|
|
20
20
|
|
|
21
21
|
static unique_ptr<FunctionData> DuckDBIndexesBind(ClientContext &context, TableFunctionBindInput &input,
|
|
22
22
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
23
|
+
names.emplace_back("database_name");
|
|
24
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
25
|
+
|
|
26
|
+
names.emplace_back("database_oid");
|
|
27
|
+
return_types.emplace_back(LogicalType::BIGINT);
|
|
28
|
+
|
|
23
29
|
names.emplace_back("schema_name");
|
|
24
30
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
25
31
|
|
|
@@ -56,15 +62,11 @@ static unique_ptr<FunctionData> DuckDBIndexesBind(ClientContext &context, TableF
|
|
|
56
62
|
unique_ptr<GlobalTableFunctionState> DuckDBIndexesInit(ClientContext &context, TableFunctionInitInput &input) {
|
|
57
63
|
auto result = make_unique<DuckDBIndexesData>();
|
|
58
64
|
|
|
59
|
-
// scan all the schemas for tables and collect
|
|
60
|
-
auto schemas = Catalog::
|
|
65
|
+
// scan all the schemas for tables and collect them and collect them
|
|
66
|
+
auto schemas = Catalog::GetAllSchemas(context);
|
|
61
67
|
for (auto &schema : schemas) {
|
|
62
68
|
schema->Scan(context, CatalogType::INDEX_ENTRY, [&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
63
69
|
};
|
|
64
|
-
|
|
65
|
-
// check the temp schema as well
|
|
66
|
-
SchemaCatalogEntry::GetTemporaryObjects(context)->Scan(
|
|
67
|
-
context, CatalogType::INDEX_ENTRY, [&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
68
70
|
return move(result);
|
|
69
71
|
}
|
|
70
72
|
|
|
@@ -83,29 +85,34 @@ void DuckDBIndexesFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
|
83
85
|
auto &index = (IndexCatalogEntry &)*entry;
|
|
84
86
|
// return values:
|
|
85
87
|
|
|
88
|
+
idx_t col = 0;
|
|
89
|
+
// database_name, VARCHAR
|
|
90
|
+
output.SetValue(col++, count, index.catalog->GetName());
|
|
91
|
+
// database_oid, BIGINT
|
|
92
|
+
output.SetValue(col++, count, Value::BIGINT(index.catalog->GetOid()));
|
|
86
93
|
// schema_name, VARCHAR
|
|
87
|
-
output.SetValue(
|
|
94
|
+
output.SetValue(col++, count, Value(index.schema->name));
|
|
88
95
|
// schema_oid, BIGINT
|
|
89
|
-
output.SetValue(
|
|
96
|
+
output.SetValue(col++, count, Value::BIGINT(index.schema->oid));
|
|
90
97
|
// index_name, VARCHAR
|
|
91
|
-
output.SetValue(
|
|
98
|
+
output.SetValue(col++, count, Value(index.name));
|
|
92
99
|
// index_oid, BIGINT
|
|
93
|
-
output.SetValue(
|
|
100
|
+
output.SetValue(col++, count, Value::BIGINT(index.oid));
|
|
94
101
|
// table_name, VARCHAR
|
|
95
|
-
output.SetValue(
|
|
102
|
+
output.SetValue(col++, count, Value(index.info->table));
|
|
96
103
|
// table_oid, BIGINT
|
|
97
104
|
// find the table in the catalog
|
|
98
|
-
auto
|
|
99
|
-
|
|
100
|
-
output.SetValue(
|
|
105
|
+
auto table_entry =
|
|
106
|
+
index.schema->catalog->GetEntry<TableCatalogEntry>(context, index.info->schema, index.info->table);
|
|
107
|
+
output.SetValue(col++, count, Value::BIGINT(table_entry->oid));
|
|
101
108
|
// is_unique, BOOLEAN
|
|
102
|
-
output.SetValue(
|
|
109
|
+
output.SetValue(col++, count, Value::BOOLEAN(index.index->IsUnique()));
|
|
103
110
|
// is_primary, BOOLEAN
|
|
104
|
-
output.SetValue(
|
|
111
|
+
output.SetValue(col++, count, Value::BOOLEAN(index.index->IsPrimary()));
|
|
105
112
|
// expressions, VARCHAR
|
|
106
|
-
output.SetValue(
|
|
113
|
+
output.SetValue(col++, count, Value());
|
|
107
114
|
// sql, VARCHAR
|
|
108
|
-
output.SetValue(
|
|
115
|
+
output.SetValue(col++, count, Value(index.ToSQL()));
|
|
109
116
|
|
|
110
117
|
count++;
|
|
111
118
|
}
|
|
@@ -21,6 +21,12 @@ static unique_ptr<FunctionData> DuckDBSchemasBind(ClientContext &context, TableF
|
|
|
21
21
|
names.emplace_back("oid");
|
|
22
22
|
return_types.emplace_back(LogicalType::BIGINT);
|
|
23
23
|
|
|
24
|
+
names.emplace_back("database_name");
|
|
25
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
26
|
+
|
|
27
|
+
names.emplace_back("database_oid");
|
|
28
|
+
return_types.emplace_back(LogicalType::BIGINT);
|
|
29
|
+
|
|
24
30
|
names.emplace_back("schema_name");
|
|
25
31
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
26
32
|
|
|
@@ -37,10 +43,7 @@ unique_ptr<GlobalTableFunctionState> DuckDBSchemasInit(ClientContext &context, T
|
|
|
37
43
|
auto result = make_unique<DuckDBSchemasData>();
|
|
38
44
|
|
|
39
45
|
// scan all the schemas and collect them
|
|
40
|
-
Catalog::
|
|
41
|
-
context, [&](CatalogEntry *entry) { result->entries.push_back((SchemaCatalogEntry *)entry); });
|
|
42
|
-
// get the temp schema as well
|
|
43
|
-
result->entries.push_back(SchemaCatalogEntry::GetTemporaryObjects(context));
|
|
46
|
+
result->entries = Catalog::GetAllSchemas(context);
|
|
44
47
|
|
|
45
48
|
return move(result);
|
|
46
49
|
}
|
|
@@ -58,14 +61,19 @@ void DuckDBSchemasFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
|
58
61
|
auto &entry = data.entries[data.offset];
|
|
59
62
|
|
|
60
63
|
// return values:
|
|
64
|
+
idx_t col = 0;
|
|
61
65
|
// "oid", PhysicalType::BIGINT
|
|
62
|
-
output.SetValue(
|
|
66
|
+
output.SetValue(col++, count, Value::BIGINT(entry->oid));
|
|
67
|
+
// database_name, VARCHAR
|
|
68
|
+
output.SetValue(col++, count, entry->catalog->GetName());
|
|
69
|
+
// database_oid, BIGINT
|
|
70
|
+
output.SetValue(col++, count, Value::BIGINT(entry->catalog->GetOid()));
|
|
63
71
|
// "schema_name", PhysicalType::VARCHAR
|
|
64
|
-
output.SetValue(
|
|
72
|
+
output.SetValue(col++, count, Value(entry->name));
|
|
65
73
|
// "internal", PhysicalType::BOOLEAN
|
|
66
|
-
output.SetValue(
|
|
74
|
+
output.SetValue(col++, count, Value::BOOLEAN(entry->internal));
|
|
67
75
|
// "sql", PhysicalType::VARCHAR
|
|
68
|
-
output.SetValue(
|
|
76
|
+
output.SetValue(col++, count, Value());
|
|
69
77
|
|
|
70
78
|
data.offset++;
|
|
71
79
|
count++;
|
|
@@ -13,12 +13,18 @@ struct DuckDBSequencesData : public GlobalTableFunctionState {
|
|
|
13
13
|
DuckDBSequencesData() : offset(0) {
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
vector<
|
|
16
|
+
vector<SequenceCatalogEntry *> entries;
|
|
17
17
|
idx_t offset;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
static unique_ptr<FunctionData> DuckDBSequencesBind(ClientContext &context, TableFunctionBindInput &input,
|
|
21
21
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
22
|
+
names.emplace_back("database_name");
|
|
23
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
24
|
+
|
|
25
|
+
names.emplace_back("database_oid");
|
|
26
|
+
return_types.emplace_back(LogicalType::BIGINT);
|
|
27
|
+
|
|
22
28
|
names.emplace_back("schema_name");
|
|
23
29
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
24
30
|
|
|
@@ -62,15 +68,11 @@ unique_ptr<GlobalTableFunctionState> DuckDBSequencesInit(ClientContext &context,
|
|
|
62
68
|
auto result = make_unique<DuckDBSequencesData>();
|
|
63
69
|
|
|
64
70
|
// scan all the schemas for tables and collect themand collect them
|
|
65
|
-
auto schemas = Catalog::
|
|
71
|
+
auto schemas = Catalog::GetAllSchemas(context);
|
|
66
72
|
for (auto &schema : schemas) {
|
|
67
73
|
schema->Scan(context, CatalogType::SEQUENCE_ENTRY,
|
|
68
|
-
[&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
74
|
+
[&](CatalogEntry *entry) { result->entries.push_back((SequenceCatalogEntry *)entry); });
|
|
69
75
|
};
|
|
70
|
-
|
|
71
|
-
// check the temp schema as well
|
|
72
|
-
SchemaCatalogEntry::GetTemporaryObjects(context)->Scan(
|
|
73
|
-
context, CatalogType::SEQUENCE_ENTRY, [&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
74
76
|
return move(result);
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -88,30 +90,35 @@ void DuckDBSequencesFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
|
88
90
|
|
|
89
91
|
auto &seq = (SequenceCatalogEntry &)*entry;
|
|
90
92
|
// return values:
|
|
93
|
+
idx_t col = 0;
|
|
94
|
+
// database_name, VARCHAR
|
|
95
|
+
output.SetValue(col++, count, entry->catalog->GetName());
|
|
96
|
+
// database_oid, BIGINT
|
|
97
|
+
output.SetValue(col++, count, Value::BIGINT(entry->catalog->GetOid()));
|
|
91
98
|
// schema_name, VARCHAR
|
|
92
|
-
output.SetValue(
|
|
99
|
+
output.SetValue(col++, count, Value(seq.schema->name));
|
|
93
100
|
// schema_oid, BIGINT
|
|
94
|
-
output.SetValue(
|
|
101
|
+
output.SetValue(col++, count, Value::BIGINT(seq.schema->oid));
|
|
95
102
|
// sequence_name, VARCHAR
|
|
96
|
-
output.SetValue(
|
|
103
|
+
output.SetValue(col++, count, Value(seq.name));
|
|
97
104
|
// sequence_oid, BIGINT
|
|
98
|
-
output.SetValue(
|
|
105
|
+
output.SetValue(col++, count, Value::BIGINT(seq.oid));
|
|
99
106
|
// temporary, BOOLEAN
|
|
100
|
-
output.SetValue(
|
|
107
|
+
output.SetValue(col++, count, Value::BOOLEAN(seq.temporary));
|
|
101
108
|
// start_value, BIGINT
|
|
102
|
-
output.SetValue(
|
|
109
|
+
output.SetValue(col++, count, Value::BIGINT(seq.start_value));
|
|
103
110
|
// min_value, BIGINT
|
|
104
|
-
output.SetValue(
|
|
111
|
+
output.SetValue(col++, count, Value::BIGINT(seq.min_value));
|
|
105
112
|
// max_value, BIGINT
|
|
106
|
-
output.SetValue(
|
|
113
|
+
output.SetValue(col++, count, Value::BIGINT(seq.max_value));
|
|
107
114
|
// increment_by, BIGINT
|
|
108
|
-
output.SetValue(
|
|
115
|
+
output.SetValue(col++, count, Value::BIGINT(seq.increment));
|
|
109
116
|
// cycle, BOOLEAN
|
|
110
|
-
output.SetValue(
|
|
117
|
+
output.SetValue(col++, count, Value::BOOLEAN(seq.cycle));
|
|
111
118
|
// last_value, BIGINT
|
|
112
|
-
output.SetValue(
|
|
119
|
+
output.SetValue(col++, count, seq.usage_count == 0 ? Value() : Value::BOOLEAN(seq.last_value));
|
|
113
120
|
// sql, LogicalType::VARCHAR
|
|
114
|
-
output.SetValue(
|
|
121
|
+
output.SetValue(col++, count, Value(seq.ToSQL()));
|
|
115
122
|
|
|
116
123
|
count++;
|
|
117
124
|
}
|
|
@@ -22,6 +22,12 @@ struct DuckDBTablesData : public GlobalTableFunctionState {
|
|
|
22
22
|
|
|
23
23
|
static unique_ptr<FunctionData> DuckDBTablesBind(ClientContext &context, TableFunctionBindInput &input,
|
|
24
24
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
25
|
+
names.emplace_back("database_name");
|
|
26
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
27
|
+
|
|
28
|
+
names.emplace_back("database_oid");
|
|
29
|
+
return_types.emplace_back(LogicalType::BIGINT);
|
|
30
|
+
|
|
25
31
|
names.emplace_back("schema_name");
|
|
26
32
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
27
33
|
|
|
@@ -65,14 +71,10 @@ unique_ptr<GlobalTableFunctionState> DuckDBTablesInit(ClientContext &context, Ta
|
|
|
65
71
|
auto result = make_unique<DuckDBTablesData>();
|
|
66
72
|
|
|
67
73
|
// scan all the schemas for tables and collect themand collect them
|
|
68
|
-
auto schemas = Catalog::
|
|
74
|
+
auto schemas = Catalog::GetAllSchemas(context);
|
|
69
75
|
for (auto &schema : schemas) {
|
|
70
76
|
schema->Scan(context, CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
71
77
|
};
|
|
72
|
-
|
|
73
|
-
// check the temp schema as well
|
|
74
|
-
SchemaCatalogEntry::GetTemporaryObjects(context)->Scan(
|
|
75
|
-
context, CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) { result->entries.push_back(entry); });
|
|
76
78
|
return move(result);
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -115,30 +117,35 @@ void DuckDBTablesFunction(ClientContext &context, TableFunctionInput &data_p, Da
|
|
|
115
117
|
}
|
|
116
118
|
auto &table = (TableCatalogEntry &)*entry;
|
|
117
119
|
// return values:
|
|
120
|
+
idx_t col = 0;
|
|
121
|
+
// database_name, VARCHAR
|
|
122
|
+
output.SetValue(col++, count, entry->catalog->GetName());
|
|
123
|
+
// database_oid, BIGINT
|
|
124
|
+
output.SetValue(col++, count, Value::BIGINT(entry->catalog->GetOid()));
|
|
118
125
|
// schema_name, LogicalType::VARCHAR
|
|
119
|
-
output.SetValue(
|
|
126
|
+
output.SetValue(col++, count, Value(table.schema->name));
|
|
120
127
|
// schema_oid, LogicalType::BIGINT
|
|
121
|
-
output.SetValue(
|
|
128
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema->oid));
|
|
122
129
|
// table_name, LogicalType::VARCHAR
|
|
123
|
-
output.SetValue(
|
|
130
|
+
output.SetValue(col++, count, Value(table.name));
|
|
124
131
|
// table_oid, LogicalType::BIGINT
|
|
125
|
-
output.SetValue(
|
|
132
|
+
output.SetValue(col++, count, Value::BIGINT(table.oid));
|
|
126
133
|
// internal, LogicalType::BOOLEAN
|
|
127
|
-
output.SetValue(
|
|
134
|
+
output.SetValue(col++, count, Value::BOOLEAN(table.internal));
|
|
128
135
|
// temporary, LogicalType::BOOLEAN
|
|
129
|
-
output.SetValue(
|
|
136
|
+
output.SetValue(col++, count, Value::BOOLEAN(table.temporary));
|
|
130
137
|
// has_primary_key, LogicalType::BOOLEAN
|
|
131
|
-
output.SetValue(
|
|
138
|
+
output.SetValue(col++, count, Value::BOOLEAN(TableHasPrimaryKey(table)));
|
|
132
139
|
// estimated_size, LogicalType::BIGINT
|
|
133
|
-
output.SetValue(
|
|
140
|
+
output.SetValue(col++, count, Value::BIGINT(table.storage->info->cardinality.load()));
|
|
134
141
|
// column_count, LogicalType::BIGINT
|
|
135
|
-
output.SetValue(
|
|
142
|
+
output.SetValue(col++, count, Value::BIGINT(table.columns.LogicalColumnCount()));
|
|
136
143
|
// index_count, LogicalType::BIGINT
|
|
137
|
-
output.SetValue(
|
|
144
|
+
output.SetValue(col++, count, Value::BIGINT(table.storage->info->indexes.Count()));
|
|
138
145
|
// check_constraint_count, LogicalType::BIGINT
|
|
139
|
-
output.SetValue(
|
|
146
|
+
output.SetValue(col++, count, Value::BIGINT(CheckConstraintCount(table)));
|
|
140
147
|
// sql, LogicalType::VARCHAR
|
|
141
|
-
output.SetValue(
|
|
148
|
+
output.SetValue(col++, count, Value(table.ToSQL()));
|
|
142
149
|
|
|
143
150
|
count++;
|
|
144
151
|
}
|
|
@@ -20,6 +20,12 @@ struct DuckDBTypesData : public GlobalTableFunctionState {
|
|
|
20
20
|
|
|
21
21
|
static unique_ptr<FunctionData> DuckDBTypesBind(ClientContext &context, TableFunctionBindInput &input,
|
|
22
22
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
23
|
+
names.emplace_back("database_name");
|
|
24
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
25
|
+
|
|
26
|
+
names.emplace_back("database_oid");
|
|
27
|
+
return_types.emplace_back(LogicalType::BIGINT);
|
|
28
|
+
|
|
23
29
|
names.emplace_back("schema_name");
|
|
24
30
|
return_types.emplace_back(LogicalType::VARCHAR);
|
|
25
31
|
|
|
@@ -53,16 +59,11 @@ static unique_ptr<FunctionData> DuckDBTypesBind(ClientContext &context, TableFun
|
|
|
53
59
|
|
|
54
60
|
unique_ptr<GlobalTableFunctionState> DuckDBTypesInit(ClientContext &context, TableFunctionInitInput &input) {
|
|
55
61
|
auto result = make_unique<DuckDBTypesData>();
|
|
56
|
-
auto schemas = Catalog::
|
|
62
|
+
auto schemas = Catalog::GetAllSchemas(context);
|
|
57
63
|
for (auto &schema : schemas) {
|
|
58
64
|
schema->Scan(context, CatalogType::TYPE_ENTRY,
|
|
59
65
|
[&](CatalogEntry *entry) { result->entries.push_back((TypeCatalogEntry *)entry); });
|
|
60
66
|
};
|
|
61
|
-
|
|
62
|
-
// check the temp schema as well
|
|
63
|
-
SchemaCatalogEntry::GetTemporaryObjects(context)->Scan(context, CatalogType::TYPE_ENTRY, [&](CatalogEntry *entry) {
|
|
64
|
-
result->entries.push_back((TypeCatalogEntry *)entry);
|
|
65
|
-
});
|
|
66
67
|
return move(result);
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -80,10 +81,15 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
|
80
81
|
auto &type = type_entry->user_type;
|
|
81
82
|
|
|
82
83
|
// return values:
|
|
84
|
+
idx_t col = 0;
|
|
85
|
+
// database_name, VARCHAR
|
|
86
|
+
output.SetValue(col++, count, type_entry->catalog->GetName());
|
|
87
|
+
// database_oid, BIGINT
|
|
88
|
+
output.SetValue(col++, count, Value::BIGINT(type_entry->catalog->GetOid()));
|
|
83
89
|
// schema_name, LogicalType::VARCHAR
|
|
84
|
-
output.SetValue(
|
|
90
|
+
output.SetValue(col++, count, Value(type_entry->schema->name));
|
|
85
91
|
// schema_oid, LogicalType::BIGINT
|
|
86
|
-
output.SetValue(
|
|
92
|
+
output.SetValue(col++, count, Value::BIGINT(type_entry->schema->oid));
|
|
87
93
|
// type_oid, BIGINT
|
|
88
94
|
int64_t oid;
|
|
89
95
|
if (type_entry->internal) {
|
|
@@ -98,15 +104,15 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
|
98
104
|
} else {
|
|
99
105
|
oid_val = Value();
|
|
100
106
|
}
|
|
101
|
-
output.SetValue(
|
|
107
|
+
output.SetValue(col++, count, oid_val);
|
|
102
108
|
// type_name, VARCHAR
|
|
103
|
-
output.SetValue(
|
|
109
|
+
output.SetValue(col++, count, Value(type_entry->name));
|
|
104
110
|
// type_size, BIGINT
|
|
105
111
|
auto internal_type = type.InternalType();
|
|
106
|
-
output.SetValue(
|
|
112
|
+
output.SetValue(col++, count,
|
|
107
113
|
internal_type == PhysicalType::INVALID ? Value() : Value::BIGINT(GetTypeIdSize(internal_type)));
|
|
108
114
|
// logical_type, VARCHAR
|
|
109
|
-
output.SetValue(
|
|
115
|
+
output.SetValue(col++, count, Value(LogicalTypeIdToString(type.id())));
|
|
110
116
|
// type_category, VARCHAR
|
|
111
117
|
string category;
|
|
112
118
|
switch (type.id()) {
|
|
@@ -151,9 +157,9 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
|
151
157
|
default:
|
|
152
158
|
break;
|
|
153
159
|
}
|
|
154
|
-
output.SetValue(
|
|
160
|
+
output.SetValue(col++, count, category.empty() ? Value() : Value(category));
|
|
155
161
|
// internal, BOOLEAN
|
|
156
|
-
output.SetValue(
|
|
162
|
+
output.SetValue(col++, count, Value::BOOLEAN(type_entry->internal));
|
|
157
163
|
// labels, VARCHAR[]
|
|
158
164
|
if (type.id() == LogicalTypeId::ENUM && type.AuxInfo()) {
|
|
159
165
|
auto data = FlatVector::GetData<string_t>(EnumType::GetValuesInsertOrder(type));
|
|
@@ -164,9 +170,9 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
|
164
170
|
labels.emplace_back(data[i]);
|
|
165
171
|
}
|
|
166
172
|
|
|
167
|
-
output.SetValue(
|
|
173
|
+
output.SetValue(col++, count, Value::LIST(labels));
|
|
168
174
|
} else {
|
|
169
|
-
output.SetValue(
|
|
175
|
+
output.SetValue(col++, count, Value());
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
count++;
|