duckdb 0.7.2-dev2507.0 → 0.7.2-dev2552.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/package.json +1 -1
- package/src/connection.cpp +1 -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 +3 -3
- package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +4 -4
- package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-timebucket.cpp +1 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +4 -4
- package/src/duckdb/extension/json/json-extension.cpp +6 -6
- package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -8
- package/src/duckdb/src/catalog/catalog.cpp +166 -127
- package/src/duckdb/src/catalog/catalog_entry/copy_function_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +90 -82
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +65 -67
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +8 -8
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +10 -10
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +9 -9
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +5 -5
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +23 -23
- package/src/duckdb/src/catalog/catalog_entry.cpp +27 -6
- package/src/duckdb/src/catalog/catalog_search_path.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +84 -87
- package/src/duckdb/src/catalog/catalog_transaction.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_types.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
- package/src/duckdb/src/catalog/dependency_list.cpp +2 -2
- package/src/duckdb/src/catalog/dependency_manager.cpp +9 -10
- package/src/duckdb/src/catalog/duck_catalog.cpp +30 -26
- package/src/duckdb/src/catalog/similar_catalog_entry.cpp +1 -1
- package/src/duckdb/src/common/types.cpp +15 -27
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +4 -3
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +19 -18
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +5 -5
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +6 -5
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +1 -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 +4 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +4 -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_update.cpp +1 -1
- package/src/duckdb/src/function/built_in_functions.cpp +10 -10
- package/src/duckdb/src/function/function_binder.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +5 -6
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -2
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +9 -8
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +6 -6
- package/src/duckdb/src/function/table/arrow.cpp +5 -5
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +8 -7
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +14 -14
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +26 -25
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +13 -12
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +7 -7
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +8 -9
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -9
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +13 -13
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +11 -10
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +5 -5
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +3 -3
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +2 -2
- package/src/duckdb/src/function/table/table_scan.cpp +39 -37
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/udf_function.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +122 -81
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +2 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/collate_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +24 -20
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +22 -17
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +28 -7
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +20 -19
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -9
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +10 -4
- package/src/duckdb/src/include/duckdb/common/enums/on_entry_not_found.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/types.hpp +3 -4
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +5 -4
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +28 -15
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +7 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +5 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +13 -0
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +4 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +12 -0
- package/src/duckdb/src/main/attached_database.cpp +12 -6
- package/src/duckdb/src/main/capi/table_function-c.cpp +17 -16
- package/src/duckdb/src/main/client_context.cpp +12 -11
- package/src/duckdb/src/main/database_manager.cpp +13 -12
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -2
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +9 -9
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +2 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +5 -1
- package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +26 -27
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +17 -17
- package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +9 -9
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +21 -21
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +2 -3
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +33 -36
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +5 -5
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +4 -4
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +7 -7
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +14 -13
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +36 -35
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +5 -4
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +3 -3
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +10 -12
- package/src/duckdb/src/planner/binder.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_expression.cpp +11 -2
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +2 -5
- package/src/duckdb/src/planner/operator/logical_create.cpp +2 -1
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_delete.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +2 -7
- package/src/duckdb/src/planner/operator/logical_update.cpp +2 -6
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +2 -2
- package/src/duckdb/src/planner/pragma_handler.cpp +3 -4
- package/src/duckdb/src/storage/checkpoint_manager.cpp +46 -46
- package/src/duckdb/src/storage/data_table.cpp +3 -6
- package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +28 -30
- package/src/duckdb/src/storage/write_ahead_log.cpp +8 -8
- package/src/duckdb/src/transaction/cleanup_state.cpp +1 -1
- package/src/duckdb/src/transaction/commit_state.cpp +3 -4
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
@@ -271,8 +271,8 @@ unique_ptr<GlobalTableFunctionState> ArrowTableFunction::ArrowScanInitGlobal(Cli
|
|
271
271
|
TableFunctionInitInput &input) {
|
272
272
|
auto &bind_data = (const ArrowScanFunctionData &)*input.bind_data;
|
273
273
|
auto result = make_uniq<ArrowScanGlobalState>();
|
274
|
-
result->stream = ProduceArrowScan(bind_data, input.column_ids, input.filters);
|
275
|
-
result->max_threads = ArrowScanMaxThreads(context, input.bind_data);
|
274
|
+
result->stream = ProduceArrowScan(bind_data, input.column_ids, input.filters.get());
|
275
|
+
result->max_threads = ArrowScanMaxThreads(context, input.bind_data.get());
|
276
276
|
if (input.CanRemoveFilterColumns()) {
|
277
277
|
result->projection_ids = input.projection_ids;
|
278
278
|
for (const auto &col_idx : input.column_ids) {
|
@@ -293,12 +293,12 @@ unique_ptr<LocalTableFunctionState> ArrowTableFunction::ArrowScanInitLocal(Execu
|
|
293
293
|
auto current_chunk = make_uniq<ArrowArrayWrapper>();
|
294
294
|
auto result = make_uniq<ArrowScanLocalState>(std::move(current_chunk));
|
295
295
|
result->column_ids = input.column_ids;
|
296
|
-
result->filters = input.filters;
|
296
|
+
result->filters = input.filters.get();
|
297
297
|
if (input.CanRemoveFilterColumns()) {
|
298
298
|
auto &asgs = global_state_p->Cast<ArrowScanGlobalState>();
|
299
299
|
result->all_columns.Initialize(context.client, asgs.scanned_types);
|
300
300
|
}
|
301
|
-
if (!ArrowScanParallelStateNext(context.client, input.bind_data, *result, global_state)) {
|
301
|
+
if (!ArrowScanParallelStateNext(context.client, input.bind_data.get(), *result, global_state)) {
|
302
302
|
return nullptr;
|
303
303
|
}
|
304
304
|
return std::move(result);
|
@@ -314,7 +314,7 @@ void ArrowTableFunction::ArrowScanFunction(ClientContext &context, TableFunction
|
|
314
314
|
|
315
315
|
//! Out of tuples in this chunk
|
316
316
|
if (state.chunk_offset >= (idx_t)state.chunk->arrow_array.length) {
|
317
|
-
if (!ArrowScanParallelStateNext(context, data_p.bind_data, state, global_state)) {
|
317
|
+
if (!ArrowScanParallelStateNext(context, data_p.bind_data.get(), state, global_state)) {
|
318
318
|
return;
|
319
319
|
}
|
320
320
|
}
|
@@ -16,7 +16,7 @@ struct DuckDBColumnsData : public GlobalTableFunctionState {
|
|
16
16
|
DuckDBColumnsData() : offset(0), column_offset(0) {
|
17
17
|
}
|
18
18
|
|
19
|
-
vector<
|
19
|
+
vector<reference<CatalogEntry>> entries;
|
20
20
|
idx_t offset;
|
21
21
|
idx_t column_offset;
|
22
22
|
};
|
@@ -83,7 +83,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBColumnsInit(ClientContext &context, T
|
|
83
83
|
// scan all the schemas for tables and views and collect them
|
84
84
|
auto schemas = Catalog::GetAllSchemas(context);
|
85
85
|
for (auto &schema : schemas) {
|
86
|
-
schema
|
86
|
+
schema.get().Scan(context, CatalogType::TABLE_ENTRY,
|
87
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
87
88
|
}
|
88
89
|
return std::move(result);
|
89
90
|
}
|
@@ -190,13 +191,13 @@ void ColumnHelper::WriteColumns(idx_t start_index, idx_t start_col, idx_t end_co
|
|
190
191
|
|
191
192
|
idx_t col = 0;
|
192
193
|
// database_name, VARCHAR
|
193
|
-
output.SetValue(col++, index, entry.catalog
|
194
|
+
output.SetValue(col++, index, entry.catalog.GetName());
|
194
195
|
// database_oid, BIGINT
|
195
|
-
output.SetValue(col++, index, Value::BIGINT(entry.catalog
|
196
|
+
output.SetValue(col++, index, Value::BIGINT(entry.catalog.GetOid()));
|
196
197
|
// schema_name, VARCHAR
|
197
|
-
output.SetValue(col++, index, entry.schema
|
198
|
+
output.SetValue(col++, index, entry.schema.name);
|
198
199
|
// schema_oid, BIGINT
|
199
|
-
output.SetValue(col++, index, Value::BIGINT(entry.schema
|
200
|
+
output.SetValue(col++, index, Value::BIGINT(entry.schema.oid));
|
200
201
|
// table_name, VARCHAR
|
201
202
|
output.SetValue(col++, index, entry.name);
|
202
203
|
// table_oid, BIGINT
|
@@ -298,7 +299,7 @@ void DuckDBColumnsFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
298
299
|
idx_t column_offset = data.column_offset;
|
299
300
|
idx_t index = 0;
|
300
301
|
while (next < data.entries.size() && index < STANDARD_VECTOR_SIZE) {
|
301
|
-
auto column_helper = ColumnHelper::Create(
|
302
|
+
auto column_helper = ColumnHelper::Create(data.entries[next].get());
|
302
303
|
idx_t columns = column_helper->NumColumns();
|
303
304
|
|
304
305
|
// Check to see if we are going to exceed the maximum index for a DataChunk
|
@@ -53,7 +53,7 @@ struct DuckDBConstraintsData : public GlobalTableFunctionState {
|
|
53
53
|
DuckDBConstraintsData() : offset(0), constraint_offset(0), unique_constraint_offset(0) {
|
54
54
|
}
|
55
55
|
|
56
|
-
vector<
|
56
|
+
vector<reference<CatalogEntry>> entries;
|
57
57
|
idx_t offset;
|
58
58
|
idx_t constraint_offset;
|
59
59
|
idx_t unique_constraint_offset;
|
@@ -109,15 +109,15 @@ unique_ptr<GlobalTableFunctionState> DuckDBConstraintsInit(ClientContext &contex
|
|
109
109
|
auto schemas = Catalog::GetAllSchemas(context);
|
110
110
|
|
111
111
|
for (auto &schema : schemas) {
|
112
|
-
vector<CatalogEntry
|
112
|
+
vector<reference<CatalogEntry>> entries;
|
113
113
|
|
114
|
-
schema
|
115
|
-
if (entry
|
114
|
+
schema.get().Scan(context, CatalogType::TABLE_ENTRY, [&](CatalogEntry &entry) {
|
115
|
+
if (entry.type == CatalogType::TABLE_ENTRY) {
|
116
116
|
entries.push_back(entry);
|
117
117
|
}
|
118
118
|
});
|
119
119
|
|
120
|
-
sort(entries.begin(), entries.end(), [&](CatalogEntry
|
120
|
+
sort(entries.begin(), entries.end(), [&](CatalogEntry &x, CatalogEntry &y) { return (x.name < y.name); });
|
121
121
|
|
122
122
|
result->entries.insert(result->entries.end(), entries.begin(), entries.end());
|
123
123
|
};
|
@@ -135,7 +135,7 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
135
135
|
// either fill up the chunk or return all the remaining columns
|
136
136
|
idx_t count = 0;
|
137
137
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
138
|
-
auto &entry =
|
138
|
+
auto &entry = data.entries[data.offset].get();
|
139
139
|
D_ASSERT(entry.type == CatalogType::TABLE_ENTRY);
|
140
140
|
|
141
141
|
auto &table = entry.Cast<TableCatalogEntry>();
|
@@ -178,13 +178,13 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
178
178
|
|
179
179
|
idx_t col = 0;
|
180
180
|
// database_name, LogicalType::VARCHAR
|
181
|
-
output.SetValue(col++, count, Value(table.schema
|
181
|
+
output.SetValue(col++, count, Value(table.schema.catalog.GetName()));
|
182
182
|
// database_oid, LogicalType::BIGINT
|
183
|
-
output.SetValue(col++, count, Value::BIGINT(table.schema
|
183
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema.catalog.GetOid()));
|
184
184
|
// schema_name, LogicalType::VARCHAR
|
185
|
-
output.SetValue(col++, count, Value(table.schema
|
185
|
+
output.SetValue(col++, count, Value(table.schema.name));
|
186
186
|
// schema_oid, LogicalType::BIGINT
|
187
|
-
output.SetValue(col++, count, Value::BIGINT(table.schema
|
187
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema.oid));
|
188
188
|
// table_name, LogicalType::VARCHAR
|
189
189
|
output.SetValue(col++, count, Value(table.name));
|
190
190
|
// table_oid, LogicalType::BIGINT
|
@@ -198,15 +198,15 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
198
198
|
switch (bound_constraint.type) {
|
199
199
|
case ConstraintType::UNIQUE: {
|
200
200
|
auto &bound_unique = bound_constraint.Cast<BoundUniqueConstraint>();
|
201
|
-
uk_info = {table.schema
|
201
|
+
uk_info = {table.schema.name, table.name, bound_unique.keys};
|
202
202
|
break;
|
203
203
|
}
|
204
204
|
case ConstraintType::FOREIGN_KEY: {
|
205
205
|
const auto &bound_foreign_key = bound_constraint.Cast<BoundForeignKeyConstraint>();
|
206
206
|
const auto &info = bound_foreign_key.info;
|
207
207
|
// find the other table
|
208
|
-
auto table_entry = Catalog::GetEntry<TableCatalogEntry>(
|
209
|
-
|
208
|
+
auto table_entry = Catalog::GetEntry<TableCatalogEntry>(
|
209
|
+
context, table.catalog.GetName(), info.schema, info.table, OnEntryNotFound::RETURN_NULL);
|
210
210
|
if (!table_entry) {
|
211
211
|
throw InternalException("dukdb_constraints: entry %s.%s referenced in foreign key not found",
|
212
212
|
info.schema, info.table);
|
@@ -215,7 +215,7 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
215
215
|
for (auto &key : info.pk_keys) {
|
216
216
|
index.push_back(table_entry->GetColumns().PhysicalToLogical(key));
|
217
217
|
}
|
218
|
-
uk_info = {table_entry->schema
|
218
|
+
uk_info = {table_entry->schema.name, table_entry->name, index};
|
219
219
|
break;
|
220
220
|
}
|
221
221
|
default:
|
@@ -8,7 +8,7 @@ struct DuckDBDatabasesData : public GlobalTableFunctionState {
|
|
8
8
|
DuckDBDatabasesData() : offset(0) {
|
9
9
|
}
|
10
10
|
|
11
|
-
vector<
|
11
|
+
vector<reference<AttachedDatabase>> entries;
|
12
12
|
idx_t offset;
|
13
13
|
};
|
14
14
|
|
@@ -53,7 +53,7 @@ void DuckDBDatabasesFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
53
53
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
54
54
|
auto &entry = data.entries[data.offset++];
|
55
55
|
|
56
|
-
auto &attached = entry
|
56
|
+
auto &attached = entry.get().Cast<AttachedDatabase>();
|
57
57
|
// return values:
|
58
58
|
|
59
59
|
idx_t col = 0;
|
@@ -21,7 +21,7 @@ struct DuckDBFunctionsData : public GlobalTableFunctionState {
|
|
21
21
|
DuckDBFunctionsData() : offset(0), offset_in_entry(0) {
|
22
22
|
}
|
23
23
|
|
24
|
-
vector<CatalogEntry
|
24
|
+
vector<reference<CatalogEntry>> entries;
|
25
25
|
idx_t offset;
|
26
26
|
idx_t offset_in_entry;
|
27
27
|
};
|
@@ -73,24 +73,26 @@ static unique_ptr<FunctionData> DuckDBFunctionsBind(ClientContext &context, Tabl
|
|
73
73
|
static void ExtractFunctionsFromSchema(ClientContext &context, SchemaCatalogEntry &schema,
|
74
74
|
DuckDBFunctionsData &result) {
|
75
75
|
schema.Scan(context, CatalogType::SCALAR_FUNCTION_ENTRY,
|
76
|
-
[&](CatalogEntry
|
76
|
+
[&](CatalogEntry &entry) { result.entries.push_back(entry); });
|
77
77
|
schema.Scan(context, CatalogType::TABLE_FUNCTION_ENTRY,
|
78
|
-
[&](CatalogEntry
|
78
|
+
[&](CatalogEntry &entry) { result.entries.push_back(entry); });
|
79
79
|
schema.Scan(context, CatalogType::PRAGMA_FUNCTION_ENTRY,
|
80
|
-
[&](CatalogEntry
|
80
|
+
[&](CatalogEntry &entry) { result.entries.push_back(entry); });
|
81
81
|
}
|
82
82
|
|
83
83
|
unique_ptr<GlobalTableFunctionState> DuckDBFunctionsInit(ClientContext &context, TableFunctionInitInput &input) {
|
84
84
|
auto result = make_uniq<DuckDBFunctionsData>();
|
85
85
|
|
86
|
-
// scan all the schemas for tables and collect
|
86
|
+
// scan all the schemas for tables and collect them and collect them
|
87
87
|
auto schemas = Catalog::GetAllSchemas(context);
|
88
88
|
for (auto &schema : schemas) {
|
89
|
-
ExtractFunctionsFromSchema(context,
|
89
|
+
ExtractFunctionsFromSchema(context, schema.get(), *result);
|
90
90
|
};
|
91
91
|
|
92
92
|
std::sort(result->entries.begin(), result->entries.end(),
|
93
|
-
[&](CatalogEntry
|
93
|
+
[&](reference<CatalogEntry> a, reference<CatalogEntry> b) {
|
94
|
+
return (int32_t)a.get().type < (int32_t)b.get().type;
|
95
|
+
});
|
94
96
|
return std::move(result);
|
95
97
|
}
|
96
98
|
|
@@ -420,18 +422,18 @@ struct PragmaFunctionExtractor {
|
|
420
422
|
};
|
421
423
|
|
422
424
|
template <class T, class OP>
|
423
|
-
bool ExtractFunctionData(
|
424
|
-
auto &function = (
|
425
|
+
bool ExtractFunctionData(CatalogEntry &entry, idx_t function_idx, DataChunk &output, idx_t output_offset) {
|
426
|
+
auto &function = entry.Cast<T>();
|
425
427
|
idx_t col = 0;
|
426
428
|
|
427
429
|
// database_name, LogicalType::VARCHAR
|
428
|
-
output.SetValue(col++, output_offset, Value(
|
430
|
+
output.SetValue(col++, output_offset, Value(function.schema.catalog.GetName()));
|
429
431
|
|
430
432
|
// schema_name, LogicalType::VARCHAR
|
431
|
-
output.SetValue(col++, output_offset, Value(
|
433
|
+
output.SetValue(col++, output_offset, Value(function.schema.name));
|
432
434
|
|
433
435
|
// function_name, LogicalType::VARCHAR
|
434
|
-
output.SetValue(col++, output_offset, Value(
|
436
|
+
output.SetValue(col++, output_offset, Value(function.name));
|
435
437
|
|
436
438
|
// function_type, LogicalType::VARCHAR
|
437
439
|
output.SetValue(col++, output_offset, Value(OP::GetFunctionType()));
|
@@ -458,10 +460,10 @@ bool ExtractFunctionData(StandardEntry *entry, idx_t function_idx, DataChunk &ou
|
|
458
460
|
output.SetValue(col++, output_offset, OP::HasSideEffects(function, function_idx));
|
459
461
|
|
460
462
|
// internal, LogicalType::BOOLEAN
|
461
|
-
output.SetValue(col++, output_offset, Value::BOOLEAN(
|
463
|
+
output.SetValue(col++, output_offset, Value::BOOLEAN(function.internal));
|
462
464
|
|
463
465
|
// function_oid, LogicalType::BIGINT
|
464
|
-
output.SetValue(col++, output_offset, Value::BIGINT(
|
466
|
+
output.SetValue(col++, output_offset, Value::BIGINT(function.oid));
|
465
467
|
|
466
468
|
return function_idx + 1 == OP::FunctionCount(function);
|
467
469
|
}
|
@@ -476,35 +478,34 @@ void DuckDBFunctionsFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
476
478
|
// either fill up the chunk or return all the remaining columns
|
477
479
|
idx_t count = 0;
|
478
480
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
479
|
-
auto &entry = data.entries[data.offset];
|
480
|
-
auto standard_entry = (StandardEntry *)entry;
|
481
|
+
auto &entry = data.entries[data.offset].get();
|
481
482
|
bool finished;
|
482
483
|
|
483
|
-
switch (entry
|
484
|
+
switch (entry.type) {
|
484
485
|
case CatalogType::SCALAR_FUNCTION_ENTRY:
|
485
486
|
finished = ExtractFunctionData<ScalarFunctionCatalogEntry, ScalarFunctionExtractor>(
|
486
|
-
|
487
|
+
entry, data.offset_in_entry, output, count);
|
487
488
|
break;
|
488
489
|
case CatalogType::AGGREGATE_FUNCTION_ENTRY:
|
489
490
|
finished = ExtractFunctionData<AggregateFunctionCatalogEntry, AggregateFunctionExtractor>(
|
490
|
-
|
491
|
+
entry, data.offset_in_entry, output, count);
|
491
492
|
break;
|
492
493
|
case CatalogType::TABLE_MACRO_ENTRY:
|
493
|
-
finished = ExtractFunctionData<TableMacroCatalogEntry, TableMacroExtractor>(
|
494
|
-
|
494
|
+
finished = ExtractFunctionData<TableMacroCatalogEntry, TableMacroExtractor>(entry, data.offset_in_entry,
|
495
|
+
output, count);
|
495
496
|
break;
|
496
497
|
|
497
498
|
case CatalogType::MACRO_ENTRY:
|
498
|
-
finished = ExtractFunctionData<ScalarMacroCatalogEntry, MacroExtractor>(
|
499
|
-
|
499
|
+
finished = ExtractFunctionData<ScalarMacroCatalogEntry, MacroExtractor>(entry, data.offset_in_entry, output,
|
500
|
+
count);
|
500
501
|
break;
|
501
502
|
case CatalogType::TABLE_FUNCTION_ENTRY:
|
502
503
|
finished = ExtractFunctionData<TableFunctionCatalogEntry, TableFunctionExtractor>(
|
503
|
-
|
504
|
+
entry, data.offset_in_entry, output, count);
|
504
505
|
break;
|
505
506
|
case CatalogType::PRAGMA_FUNCTION_ENTRY:
|
506
507
|
finished = ExtractFunctionData<PragmaFunctionCatalogEntry, PragmaFunctionExtractor>(
|
507
|
-
|
508
|
+
entry, data.offset_in_entry, output, count);
|
508
509
|
break;
|
509
510
|
default:
|
510
511
|
throw InternalException("FIXME: unrecognized function type in duckdb_functions");
|
@@ -15,7 +15,7 @@ struct DuckDBIndexesData : public GlobalTableFunctionState {
|
|
15
15
|
DuckDBIndexesData() : offset(0) {
|
16
16
|
}
|
17
17
|
|
18
|
-
vector<CatalogEntry
|
18
|
+
vector<reference<CatalogEntry>> entries;
|
19
19
|
idx_t offset;
|
20
20
|
};
|
21
21
|
|
@@ -66,7 +66,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBIndexesInit(ClientContext &context, T
|
|
66
66
|
// scan all the schemas for tables and collect them and collect them
|
67
67
|
auto schemas = Catalog::GetAllSchemas(context);
|
68
68
|
for (auto &schema : schemas) {
|
69
|
-
schema
|
69
|
+
schema.get().Scan(context, CatalogType::INDEX_ENTRY,
|
70
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
70
71
|
};
|
71
72
|
return std::move(result);
|
72
73
|
}
|
@@ -81,31 +82,31 @@ void DuckDBIndexesFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
81
82
|
// either fill up the chunk or return all the remaining columns
|
82
83
|
idx_t count = 0;
|
83
84
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
84
|
-
auto &entry = data.entries[data.offset++];
|
85
|
+
auto &entry = data.entries[data.offset++].get();
|
85
86
|
|
86
|
-
auto &index = entry
|
87
|
+
auto &index = entry.Cast<IndexCatalogEntry>();
|
87
88
|
// return values:
|
88
89
|
|
89
90
|
idx_t col = 0;
|
90
91
|
// database_name, VARCHAR
|
91
|
-
output.SetValue(col++, count, index.catalog
|
92
|
+
output.SetValue(col++, count, index.catalog.GetName());
|
92
93
|
// database_oid, BIGINT
|
93
|
-
output.SetValue(col++, count, Value::BIGINT(index.catalog
|
94
|
+
output.SetValue(col++, count, Value::BIGINT(index.catalog.GetOid()));
|
94
95
|
// schema_name, VARCHAR
|
95
|
-
output.SetValue(col++, count, Value(index.schema
|
96
|
+
output.SetValue(col++, count, Value(index.schema.name));
|
96
97
|
// schema_oid, BIGINT
|
97
|
-
output.SetValue(col++, count, Value::BIGINT(index.schema
|
98
|
+
output.SetValue(col++, count, Value::BIGINT(index.schema.oid));
|
98
99
|
// index_name, VARCHAR
|
99
100
|
output.SetValue(col++, count, Value(index.name));
|
100
101
|
// index_oid, BIGINT
|
101
102
|
output.SetValue(col++, count, Value::BIGINT(index.oid));
|
102
103
|
// find the table in the catalog
|
103
|
-
auto table_entry =
|
104
|
-
index.schema
|
104
|
+
auto &table_entry =
|
105
|
+
index.schema.catalog.GetEntry<TableCatalogEntry>(context, index.GetSchemaName(), index.GetTableName());
|
105
106
|
// table_name, VARCHAR
|
106
|
-
output.SetValue(col++, count, Value(table_entry
|
107
|
+
output.SetValue(col++, count, Value(table_entry.name));
|
107
108
|
// table_oid, BIGINT
|
108
|
-
output.SetValue(col++, count, Value::BIGINT(table_entry
|
109
|
+
output.SetValue(col++, count, Value::BIGINT(table_entry.oid));
|
109
110
|
if (index.index) {
|
110
111
|
// is_unique, BOOLEAN
|
111
112
|
output.SetValue(col++, count, Value::BOOLEAN(index.index->IsUnique()));
|
@@ -12,7 +12,7 @@ struct DuckDBSchemasData : public GlobalTableFunctionState {
|
|
12
12
|
DuckDBSchemasData() : offset(0) {
|
13
13
|
}
|
14
14
|
|
15
|
-
vector<SchemaCatalogEntry
|
15
|
+
vector<reference<SchemaCatalogEntry>> entries;
|
16
16
|
idx_t offset;
|
17
17
|
};
|
18
18
|
|
@@ -58,20 +58,20 @@ void DuckDBSchemasFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
58
58
|
// either fill up the chunk or return all the remaining columns
|
59
59
|
idx_t count = 0;
|
60
60
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
61
|
-
auto &entry = data.entries[data.offset];
|
61
|
+
auto &entry = data.entries[data.offset].get();
|
62
62
|
|
63
63
|
// return values:
|
64
64
|
idx_t col = 0;
|
65
65
|
// "oid", PhysicalType::BIGINT
|
66
|
-
output.SetValue(col++, count, Value::BIGINT(entry
|
66
|
+
output.SetValue(col++, count, Value::BIGINT(entry.oid));
|
67
67
|
// database_name, VARCHAR
|
68
|
-
output.SetValue(col++, count, entry
|
68
|
+
output.SetValue(col++, count, entry.catalog.GetName());
|
69
69
|
// database_oid, BIGINT
|
70
|
-
output.SetValue(col++, count, Value::BIGINT(entry
|
70
|
+
output.SetValue(col++, count, Value::BIGINT(entry.catalog.GetOid()));
|
71
71
|
// "schema_name", PhysicalType::VARCHAR
|
72
|
-
output.SetValue(col++, count, Value(entry
|
72
|
+
output.SetValue(col++, count, Value(entry.name));
|
73
73
|
// "internal", PhysicalType::BOOLEAN
|
74
|
-
output.SetValue(col++, count, Value::BOOLEAN(entry
|
74
|
+
output.SetValue(col++, count, Value::BOOLEAN(entry.internal));
|
75
75
|
// "sql", PhysicalType::VARCHAR
|
76
76
|
output.SetValue(col++, count, Value());
|
77
77
|
|
@@ -13,7 +13,7 @@ struct DuckDBSequencesData : public GlobalTableFunctionState {
|
|
13
13
|
DuckDBSequencesData() : offset(0) {
|
14
14
|
}
|
15
15
|
|
16
|
-
vector<SequenceCatalogEntry
|
16
|
+
vector<reference<SequenceCatalogEntry>> entries;
|
17
17
|
idx_t offset;
|
18
18
|
};
|
19
19
|
|
@@ -70,8 +70,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBSequencesInit(ClientContext &context,
|
|
70
70
|
// scan all the schemas for tables and collect themand collect them
|
71
71
|
auto schemas = Catalog::GetAllSchemas(context);
|
72
72
|
for (auto &schema : schemas) {
|
73
|
-
schema
|
74
|
-
|
73
|
+
schema.get().Scan(context, CatalogType::SEQUENCE_ENTRY,
|
74
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry.Cast<SequenceCatalogEntry>()); });
|
75
75
|
};
|
76
76
|
return std::move(result);
|
77
77
|
}
|
@@ -86,19 +86,18 @@ void DuckDBSequencesFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
86
86
|
// either fill up the chunk or return all the remaining columns
|
87
87
|
idx_t count = 0;
|
88
88
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
89
|
-
auto &
|
89
|
+
auto &seq = data.entries[data.offset++].get();
|
90
90
|
|
91
|
-
auto &seq = entry->Cast<SequenceCatalogEntry>();
|
92
91
|
// return values:
|
93
92
|
idx_t col = 0;
|
94
93
|
// database_name, VARCHAR
|
95
|
-
output.SetValue(col++, count,
|
94
|
+
output.SetValue(col++, count, seq.catalog.GetName());
|
96
95
|
// database_oid, BIGINT
|
97
|
-
output.SetValue(col++, count, Value::BIGINT(
|
96
|
+
output.SetValue(col++, count, Value::BIGINT(seq.catalog.GetOid()));
|
98
97
|
// schema_name, VARCHAR
|
99
|
-
output.SetValue(col++, count, Value(seq.schema
|
98
|
+
output.SetValue(col++, count, Value(seq.schema.name));
|
100
99
|
// schema_oid, BIGINT
|
101
|
-
output.SetValue(col++, count, Value::BIGINT(seq.schema
|
100
|
+
output.SetValue(col++, count, Value::BIGINT(seq.schema.oid));
|
102
101
|
// sequence_name, VARCHAR
|
103
102
|
output.SetValue(col++, count, Value(seq.name));
|
104
103
|
// sequence_oid, BIGINT
|
@@ -17,7 +17,7 @@ struct DuckDBTablesData : public GlobalTableFunctionState {
|
|
17
17
|
DuckDBTablesData() : offset(0) {
|
18
18
|
}
|
19
19
|
|
20
|
-
vector<CatalogEntry
|
20
|
+
vector<reference<CatalogEntry>> entries;
|
21
21
|
idx_t offset;
|
22
22
|
};
|
23
23
|
|
@@ -74,7 +74,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBTablesInit(ClientContext &context, Ta
|
|
74
74
|
// scan all the schemas for tables and collect themand collect them
|
75
75
|
auto schemas = Catalog::GetAllSchemas(context);
|
76
76
|
for (auto &schema : schemas) {
|
77
|
-
schema
|
77
|
+
schema.get().Scan(context, CatalogType::TABLE_ENTRY,
|
78
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
78
79
|
};
|
79
80
|
return std::move(result);
|
80
81
|
}
|
@@ -111,23 +112,23 @@ void DuckDBTablesFunction(ClientContext &context, TableFunctionInput &data_p, Da
|
|
111
112
|
// either fill up the chunk or return all the remaining columns
|
112
113
|
idx_t count = 0;
|
113
114
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
114
|
-
auto &entry = data.entries[data.offset++];
|
115
|
+
auto &entry = data.entries[data.offset++].get();
|
115
116
|
|
116
|
-
if (entry
|
117
|
+
if (entry.type != CatalogType::TABLE_ENTRY) {
|
117
118
|
continue;
|
118
119
|
}
|
119
|
-
auto &table = entry
|
120
|
+
auto &table = entry.Cast<TableCatalogEntry>();
|
120
121
|
auto storage_info = table.GetStorageInfo(context);
|
121
122
|
// return values:
|
122
123
|
idx_t col = 0;
|
123
124
|
// database_name, VARCHAR
|
124
|
-
output.SetValue(col++, count,
|
125
|
+
output.SetValue(col++, count, table.catalog.GetName());
|
125
126
|
// database_oid, BIGINT
|
126
|
-
output.SetValue(col++, count, Value::BIGINT(
|
127
|
+
output.SetValue(col++, count, Value::BIGINT(table.catalog.GetOid()));
|
127
128
|
// schema_name, LogicalType::VARCHAR
|
128
|
-
output.SetValue(col++, count, Value(table.schema
|
129
|
+
output.SetValue(col++, count, Value(table.schema.name));
|
129
130
|
// schema_oid, LogicalType::BIGINT
|
130
|
-
output.SetValue(col++, count, Value::BIGINT(table.schema
|
131
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema.oid));
|
131
132
|
// table_name, LogicalType::VARCHAR
|
132
133
|
output.SetValue(col++, count, Value(table.name));
|
133
134
|
// table_oid, LogicalType::BIGINT
|
@@ -13,7 +13,7 @@ struct DuckDBTypesData : public GlobalTableFunctionState {
|
|
13
13
|
DuckDBTypesData() : offset(0) {
|
14
14
|
}
|
15
15
|
|
16
|
-
vector<TypeCatalogEntry
|
16
|
+
vector<reference<TypeCatalogEntry>> entries;
|
17
17
|
idx_t offset;
|
18
18
|
unordered_set<int64_t> oids;
|
19
19
|
};
|
@@ -61,8 +61,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBTypesInit(ClientContext &context, Tab
|
|
61
61
|
auto result = make_uniq<DuckDBTypesData>();
|
62
62
|
auto schemas = Catalog::GetAllSchemas(context);
|
63
63
|
for (auto &schema : schemas) {
|
64
|
-
schema
|
65
|
-
|
64
|
+
schema.get().Scan(context, CatalogType::TYPE_ENTRY,
|
65
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry.Cast<TypeCatalogEntry>()); });
|
66
66
|
};
|
67
67
|
return std::move(result);
|
68
68
|
}
|
@@ -77,25 +77,25 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
77
77
|
// either fill up the chunk or return all the remaining columns
|
78
78
|
idx_t count = 0;
|
79
79
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
80
|
-
auto &type_entry = data.entries[data.offset++];
|
81
|
-
auto &type = type_entry
|
80
|
+
auto &type_entry = data.entries[data.offset++].get();
|
81
|
+
auto &type = type_entry.user_type;
|
82
82
|
|
83
83
|
// return values:
|
84
84
|
idx_t col = 0;
|
85
85
|
// database_name, VARCHAR
|
86
|
-
output.SetValue(col++, count, type_entry
|
86
|
+
output.SetValue(col++, count, type_entry.catalog.GetName());
|
87
87
|
// database_oid, BIGINT
|
88
|
-
output.SetValue(col++, count, Value::BIGINT(type_entry
|
88
|
+
output.SetValue(col++, count, Value::BIGINT(type_entry.catalog.GetOid()));
|
89
89
|
// schema_name, LogicalType::VARCHAR
|
90
|
-
output.SetValue(col++, count, Value(type_entry
|
90
|
+
output.SetValue(col++, count, Value(type_entry.schema.name));
|
91
91
|
// schema_oid, LogicalType::BIGINT
|
92
|
-
output.SetValue(col++, count, Value::BIGINT(type_entry
|
92
|
+
output.SetValue(col++, count, Value::BIGINT(type_entry.schema.oid));
|
93
93
|
// type_oid, BIGINT
|
94
94
|
int64_t oid;
|
95
|
-
if (type_entry
|
95
|
+
if (type_entry.internal) {
|
96
96
|
oid = int64_t(type.id());
|
97
97
|
} else {
|
98
|
-
oid = type_entry
|
98
|
+
oid = type_entry.oid;
|
99
99
|
}
|
100
100
|
Value oid_val;
|
101
101
|
if (data.oids.find(oid) == data.oids.end()) {
|
@@ -106,7 +106,7 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
106
106
|
}
|
107
107
|
output.SetValue(col++, count, oid_val);
|
108
108
|
// type_name, VARCHAR
|
109
|
-
output.SetValue(col++, count, Value(type_entry
|
109
|
+
output.SetValue(col++, count, Value(type_entry.name));
|
110
110
|
// type_size, BIGINT
|
111
111
|
auto internal_type = type.InternalType();
|
112
112
|
output.SetValue(col++, count,
|
@@ -159,7 +159,7 @@ void DuckDBTypesFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
159
159
|
}
|
160
160
|
output.SetValue(col++, count, category.empty() ? Value() : Value(category));
|
161
161
|
// internal, BOOLEAN
|
162
|
-
output.SetValue(col++, count, Value::BOOLEAN(type_entry
|
162
|
+
output.SetValue(col++, count, Value::BOOLEAN(type_entry.internal));
|
163
163
|
// labels, VARCHAR[]
|
164
164
|
if (type.id() == LogicalTypeId::ENUM && type.AuxInfo()) {
|
165
165
|
auto data = FlatVector::GetData<string_t>(EnumType::GetValuesInsertOrder(type));
|
@@ -13,7 +13,7 @@ struct DuckDBViewsData : public GlobalTableFunctionState {
|
|
13
13
|
DuckDBViewsData() : offset(0) {
|
14
14
|
}
|
15
15
|
|
16
|
-
vector<CatalogEntry
|
16
|
+
vector<reference<CatalogEntry>> entries;
|
17
17
|
idx_t offset;
|
18
18
|
};
|
19
19
|
|
@@ -58,13 +58,14 @@ unique_ptr<GlobalTableFunctionState> DuckDBViewsInit(ClientContext &context, Tab
|
|
58
58
|
// scan all the schemas for tables and collect them and collect them
|
59
59
|
auto schemas = Catalog::GetAllSchemas(context);
|
60
60
|
for (auto &schema : schemas) {
|
61
|
-
schema
|
61
|
+
schema.get().Scan(context, CatalogType::VIEW_ENTRY,
|
62
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
62
63
|
};
|
63
64
|
return std::move(result);
|
64
65
|
}
|
65
66
|
|
66
67
|
void DuckDBViewsFunction(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
|
67
|
-
auto &data =
|
68
|
+
auto &data = data_p.global_state->Cast<DuckDBViewsData>();
|
68
69
|
if (data.offset >= data.entries.size()) {
|
69
70
|
// finished returning values
|
70
71
|
return;
|
@@ -73,23 +74,23 @@ void DuckDBViewsFunction(ClientContext &context, TableFunctionInput &data_p, Dat
|
|
73
74
|
// either fill up the chunk or return all the remaining columns
|
74
75
|
idx_t count = 0;
|
75
76
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
76
|
-
auto &entry = data.entries[data.offset++];
|
77
|
+
auto &entry = data.entries[data.offset++].get();
|
77
78
|
|
78
|
-
if (entry
|
79
|
+
if (entry.type != CatalogType::VIEW_ENTRY) {
|
79
80
|
continue;
|
80
81
|
}
|
81
|
-
auto &view = entry
|
82
|
+
auto &view = entry.Cast<ViewCatalogEntry>();
|
82
83
|
|
83
84
|
// return values:
|
84
85
|
idx_t col = 0;
|
85
86
|
// database_name, VARCHAR
|
86
|
-
output.SetValue(col++, count,
|
87
|
+
output.SetValue(col++, count, view.catalog.GetName());
|
87
88
|
// database_oid, BIGINT
|
88
|
-
output.SetValue(col++, count, Value::BIGINT(
|
89
|
+
output.SetValue(col++, count, Value::BIGINT(view.catalog.GetOid()));
|
89
90
|
// schema_name, LogicalType::VARCHAR
|
90
|
-
output.SetValue(col++, count, Value(view.schema
|
91
|
+
output.SetValue(col++, count, Value(view.schema.name));
|
91
92
|
// schema_oid, LogicalType::BIGINT
|
92
|
-
output.SetValue(col++, count, Value::BIGINT(view.schema
|
93
|
+
output.SetValue(col++, count, Value::BIGINT(view.schema.oid));
|
93
94
|
// view_name, LogicalType::VARCHAR
|
94
95
|
output.SetValue(col++, count, Value(view.name));
|
95
96
|
// view_oid, LogicalType::BIGINT
|
@@ -28,8 +28,8 @@ unique_ptr<GlobalTableFunctionState> PragmaCollateInit(ClientContext &context, T
|
|
28
28
|
|
29
29
|
auto schemas = Catalog::GetAllSchemas(context);
|
30
30
|
for (auto schema : schemas) {
|
31
|
-
schema
|
32
|
-
|
31
|
+
schema.get().Scan(context, CatalogType::COLLATION_ENTRY,
|
32
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry.name); });
|
33
33
|
}
|
34
34
|
return std::move(result);
|
35
35
|
}
|