duckdb 0.7.2-dev1734.0 → 0.7.2-dev1867.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/duckdb/src/catalog/catalog.cpp +27 -27
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_set.cpp +27 -25
- package/src/duckdb/src/catalog/default/default_functions.cpp +4 -4
- package/src/duckdb/src/catalog/default/default_types.cpp +4 -4
- package/src/duckdb/src/catalog/default/default_views.cpp +4 -4
- package/src/duckdb/src/catalog/dependency_list.cpp +7 -6
- package/src/duckdb/src/catalog/dependency_manager.cpp +44 -38
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +11 -6
- package/src/duckdb/src/common/types/batched_data_collection.cpp +2 -1
- package/src/duckdb/src/common/types/column_data_allocator.cpp +1 -0
- package/src/duckdb/src/common/types/vector.cpp +2 -2
- package/src/duckdb/src/common/types.cpp +2 -2
- package/src/duckdb/src/common/vector_operations/vector_copy.cpp +14 -11
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +51 -50
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +14 -13
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +20 -20
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +3 -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/aggregate/sorted_aggregate_function.cpp +3 -3
- package/src/duckdb/src/function/cast/cast_function_set.cpp +2 -1
- package/src/duckdb/src/function/scalar/math/numeric.cpp +57 -0
- package/src/duckdb/src/function/scalar/math_functions.cpp +1 -0
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +29 -29
- package/src/duckdb/src/function/scalar/string/damerau_levenshtein.cpp +106 -0
- package/src/duckdb/src/function/scalar/string/hex.cpp +261 -78
- package/src/duckdb/src/function/scalar/string/regexp.cpp +145 -28
- package/src/duckdb/src/function/scalar/string_functions.cpp +1 -0
- package/src/duckdb/src/function/table/checkpoint.cpp +4 -4
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +24 -24
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +7 -6
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +11 -11
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +17 -18
- package/src/duckdb/src/function/table/table_scan.cpp +8 -11
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +9 -9
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry_map.hpp +38 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +4 -3
- package/src/duckdb/src/include/duckdb/catalog/default/default_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/default/default_views.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/dependency.hpp +4 -5
- package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +4 -5
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +10 -9
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/bit_utils.hpp +147 -0
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/helper.hpp +9 -0
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +29 -6
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +6 -5
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +7 -0
- package/src/duckdb/src/include/duckdb/common/types/row_data_collection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/types.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +5 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/scalar/math_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +4 -3
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -2
- package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +7 -7
- package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +11 -11
- package/src/duckdb/src/include/duckdb/optimizer/matcher/set_matcher.hpp +8 -8
- package/src/duckdb/src/include/duckdb/optimizer/rule/arithmetic_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/case_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/comparison_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/conjunction_simplification.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/rule/constant_folding.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/date_part_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/distributivity.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/empty_needle_removal.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/enum_comparison.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/equal_or_null_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/in_clause_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/like_optimizations.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/move_constants.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/regex_optimizations.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression_map.hpp +19 -6
- package/src/duckdb/src/include/duckdb/parser/expression_util.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +15 -7
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +3 -0
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +49 -126
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp128.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/algorithm/chimp_utils.hpp +0 -97
- package/src/duckdb/src/include/duckdb/storage/compression/patas/algorithm/patas.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/meta_block_reader.hpp +5 -5
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +159 -0
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -0
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +6 -5
- package/src/duckdb/src/main/client_context.cpp +1 -1
- package/src/duckdb/src/main/database.cpp +2 -1
- package/src/duckdb/src/main/database_manager.cpp +4 -4
- package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +2 -2
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +4 -4
- package/src/duckdb/src/optimizer/deliminator.cpp +13 -11
- package/src/duckdb/src/optimizer/expression_rewriter.cpp +2 -2
- package/src/duckdb/src/optimizer/filter_combiner.cpp +67 -65
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -0
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +26 -25
- package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +23 -21
- package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/case_simplification.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +6 -7
- package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +9 -8
- package/src/duckdb/src/optimizer/rule/constant_folding.cpp +7 -7
- package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/distributivity.cpp +5 -5
- package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +6 -6
- package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +4 -4
- package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +23 -26
- package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +2 -3
- package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +6 -6
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +11 -10
- package/src/duckdb/src/parser/expression_util.cpp +6 -6
- package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +3 -3
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +5 -5
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +3 -3
- package/src/duckdb/src/storage/buffer/block_handle.cpp +7 -6
- package/src/duckdb/src/storage/buffer/block_manager.cpp +3 -1
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +1 -0
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +6 -2
- package/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +7 -4
- package/src/duckdb/src/storage/buffer_manager.cpp +35 -726
- package/src/duckdb/src/storage/checkpoint_manager.cpp +2 -2
- package/src/duckdb/src/storage/meta_block_reader.cpp +6 -5
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +801 -0
- package/src/duckdb/src/storage/wal_replay.cpp +2 -2
- package/src/duckdb/src/transaction/meta_transaction.cpp +13 -13
- package/src/duckdb/src/transaction/transaction.cpp +1 -1
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
- package/src/duckdb/ub_src_function_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
package/package.json
CHANGED
@@ -111,14 +111,14 @@ CatalogEntry *Catalog::CreateTable(ClientContext &context, unique_ptr<CreateTabl
|
|
111
111
|
return CreateTable(context, bound_info.get());
|
112
112
|
}
|
113
113
|
|
114
|
-
CatalogEntry *Catalog::CreateTable(CatalogTransaction transaction, SchemaCatalogEntry
|
114
|
+
CatalogEntry *Catalog::CreateTable(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
115
115
|
BoundCreateTableInfo *info) {
|
116
|
-
return schema
|
116
|
+
return schema.CreateTable(transaction, info);
|
117
117
|
}
|
118
118
|
|
119
119
|
CatalogEntry *Catalog::CreateTable(CatalogTransaction transaction, BoundCreateTableInfo *info) {
|
120
120
|
auto schema = GetSchema(transaction, info->base->schema);
|
121
|
-
return CreateTable(transaction, schema, info);
|
121
|
+
return CreateTable(transaction, *schema, info);
|
122
122
|
}
|
123
123
|
|
124
124
|
//===--------------------------------------------------------------------===//
|
@@ -126,15 +126,15 @@ CatalogEntry *Catalog::CreateTable(CatalogTransaction transaction, BoundCreateTa
|
|
126
126
|
//===--------------------------------------------------------------------===//
|
127
127
|
CatalogEntry *Catalog::CreateView(CatalogTransaction transaction, CreateViewInfo *info) {
|
128
128
|
auto schema = GetSchema(transaction, info->schema);
|
129
|
-
return CreateView(transaction, schema, info);
|
129
|
+
return CreateView(transaction, *schema, info);
|
130
130
|
}
|
131
131
|
|
132
132
|
CatalogEntry *Catalog::CreateView(ClientContext &context, CreateViewInfo *info) {
|
133
133
|
return CreateView(GetCatalogTransaction(context), info);
|
134
134
|
}
|
135
135
|
|
136
|
-
CatalogEntry *Catalog::CreateView(CatalogTransaction transaction, SchemaCatalogEntry
|
137
|
-
return schema
|
136
|
+
CatalogEntry *Catalog::CreateView(CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateViewInfo *info) {
|
137
|
+
return schema.CreateView(transaction, info);
|
138
138
|
}
|
139
139
|
|
140
140
|
//===--------------------------------------------------------------------===//
|
@@ -142,16 +142,16 @@ CatalogEntry *Catalog::CreateView(CatalogTransaction transaction, SchemaCatalogE
|
|
142
142
|
//===--------------------------------------------------------------------===//
|
143
143
|
CatalogEntry *Catalog::CreateSequence(CatalogTransaction transaction, CreateSequenceInfo *info) {
|
144
144
|
auto schema = GetSchema(transaction, info->schema);
|
145
|
-
return CreateSequence(transaction, schema, info);
|
145
|
+
return CreateSequence(transaction, *schema, info);
|
146
146
|
}
|
147
147
|
|
148
148
|
CatalogEntry *Catalog::CreateSequence(ClientContext &context, CreateSequenceInfo *info) {
|
149
149
|
return CreateSequence(GetCatalogTransaction(context), info);
|
150
150
|
}
|
151
151
|
|
152
|
-
CatalogEntry *Catalog::CreateSequence(CatalogTransaction transaction, SchemaCatalogEntry
|
152
|
+
CatalogEntry *Catalog::CreateSequence(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
153
153
|
CreateSequenceInfo *info) {
|
154
|
-
return schema
|
154
|
+
return schema.CreateSequence(transaction, info);
|
155
155
|
}
|
156
156
|
|
157
157
|
//===--------------------------------------------------------------------===//
|
@@ -159,15 +159,15 @@ CatalogEntry *Catalog::CreateSequence(CatalogTransaction transaction, SchemaCata
|
|
159
159
|
//===--------------------------------------------------------------------===//
|
160
160
|
CatalogEntry *Catalog::CreateType(CatalogTransaction transaction, CreateTypeInfo *info) {
|
161
161
|
auto schema = GetSchema(transaction, info->schema);
|
162
|
-
return CreateType(transaction, schema, info);
|
162
|
+
return CreateType(transaction, *schema, info);
|
163
163
|
}
|
164
164
|
|
165
165
|
CatalogEntry *Catalog::CreateType(ClientContext &context, CreateTypeInfo *info) {
|
166
166
|
return CreateType(GetCatalogTransaction(context), info);
|
167
167
|
}
|
168
168
|
|
169
|
-
CatalogEntry *Catalog::CreateType(CatalogTransaction transaction, SchemaCatalogEntry
|
170
|
-
return schema
|
169
|
+
CatalogEntry *Catalog::CreateType(CatalogTransaction transaction, SchemaCatalogEntry &schema, CreateTypeInfo *info) {
|
170
|
+
return schema.CreateType(transaction, info);
|
171
171
|
}
|
172
172
|
|
173
173
|
//===--------------------------------------------------------------------===//
|
@@ -175,16 +175,16 @@ CatalogEntry *Catalog::CreateType(CatalogTransaction transaction, SchemaCatalogE
|
|
175
175
|
//===--------------------------------------------------------------------===//
|
176
176
|
CatalogEntry *Catalog::CreateTableFunction(CatalogTransaction transaction, CreateTableFunctionInfo *info) {
|
177
177
|
auto schema = GetSchema(transaction, info->schema);
|
178
|
-
return CreateTableFunction(transaction, schema, info);
|
178
|
+
return CreateTableFunction(transaction, *schema, info);
|
179
179
|
}
|
180
180
|
|
181
181
|
CatalogEntry *Catalog::CreateTableFunction(ClientContext &context, CreateTableFunctionInfo *info) {
|
182
182
|
return CreateTableFunction(GetCatalogTransaction(context), info);
|
183
183
|
}
|
184
184
|
|
185
|
-
CatalogEntry *Catalog::CreateTableFunction(CatalogTransaction transaction, SchemaCatalogEntry
|
185
|
+
CatalogEntry *Catalog::CreateTableFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
186
186
|
CreateTableFunctionInfo *info) {
|
187
|
-
return schema
|
187
|
+
return schema.CreateTableFunction(transaction, info);
|
188
188
|
}
|
189
189
|
|
190
190
|
//===--------------------------------------------------------------------===//
|
@@ -192,16 +192,16 @@ CatalogEntry *Catalog::CreateTableFunction(CatalogTransaction transaction, Schem
|
|
192
192
|
//===--------------------------------------------------------------------===//
|
193
193
|
CatalogEntry *Catalog::CreateCopyFunction(CatalogTransaction transaction, CreateCopyFunctionInfo *info) {
|
194
194
|
auto schema = GetSchema(transaction, info->schema);
|
195
|
-
return CreateCopyFunction(transaction, schema, info);
|
195
|
+
return CreateCopyFunction(transaction, *schema, info);
|
196
196
|
}
|
197
197
|
|
198
198
|
CatalogEntry *Catalog::CreateCopyFunction(ClientContext &context, CreateCopyFunctionInfo *info) {
|
199
199
|
return CreateCopyFunction(GetCatalogTransaction(context), info);
|
200
200
|
}
|
201
201
|
|
202
|
-
CatalogEntry *Catalog::CreateCopyFunction(CatalogTransaction transaction, SchemaCatalogEntry
|
202
|
+
CatalogEntry *Catalog::CreateCopyFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
203
203
|
CreateCopyFunctionInfo *info) {
|
204
|
-
return schema
|
204
|
+
return schema.CreateCopyFunction(transaction, info);
|
205
205
|
}
|
206
206
|
|
207
207
|
//===--------------------------------------------------------------------===//
|
@@ -209,16 +209,16 @@ CatalogEntry *Catalog::CreateCopyFunction(CatalogTransaction transaction, Schema
|
|
209
209
|
//===--------------------------------------------------------------------===//
|
210
210
|
CatalogEntry *Catalog::CreatePragmaFunction(CatalogTransaction transaction, CreatePragmaFunctionInfo *info) {
|
211
211
|
auto schema = GetSchema(transaction, info->schema);
|
212
|
-
return CreatePragmaFunction(transaction, schema, info);
|
212
|
+
return CreatePragmaFunction(transaction, *schema, info);
|
213
213
|
}
|
214
214
|
|
215
215
|
CatalogEntry *Catalog::CreatePragmaFunction(ClientContext &context, CreatePragmaFunctionInfo *info) {
|
216
216
|
return CreatePragmaFunction(GetCatalogTransaction(context), info);
|
217
217
|
}
|
218
218
|
|
219
|
-
CatalogEntry *Catalog::CreatePragmaFunction(CatalogTransaction transaction, SchemaCatalogEntry
|
219
|
+
CatalogEntry *Catalog::CreatePragmaFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
220
220
|
CreatePragmaFunctionInfo *info) {
|
221
|
-
return schema
|
221
|
+
return schema.CreatePragmaFunction(transaction, info);
|
222
222
|
}
|
223
223
|
|
224
224
|
//===--------------------------------------------------------------------===//
|
@@ -226,16 +226,16 @@ CatalogEntry *Catalog::CreatePragmaFunction(CatalogTransaction transaction, Sche
|
|
226
226
|
//===--------------------------------------------------------------------===//
|
227
227
|
CatalogEntry *Catalog::CreateFunction(CatalogTransaction transaction, CreateFunctionInfo *info) {
|
228
228
|
auto schema = GetSchema(transaction, info->schema);
|
229
|
-
return CreateFunction(transaction, schema, info);
|
229
|
+
return CreateFunction(transaction, *schema, info);
|
230
230
|
}
|
231
231
|
|
232
232
|
CatalogEntry *Catalog::CreateFunction(ClientContext &context, CreateFunctionInfo *info) {
|
233
233
|
return CreateFunction(GetCatalogTransaction(context), info);
|
234
234
|
}
|
235
235
|
|
236
|
-
CatalogEntry *Catalog::CreateFunction(CatalogTransaction transaction, SchemaCatalogEntry
|
236
|
+
CatalogEntry *Catalog::CreateFunction(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
237
237
|
CreateFunctionInfo *info) {
|
238
|
-
return schema
|
238
|
+
return schema.CreateFunction(transaction, info);
|
239
239
|
}
|
240
240
|
|
241
241
|
CatalogEntry *Catalog::AddFunction(ClientContext &context, CreateFunctionInfo *info) {
|
@@ -248,16 +248,16 @@ CatalogEntry *Catalog::AddFunction(ClientContext &context, CreateFunctionInfo *i
|
|
248
248
|
//===--------------------------------------------------------------------===//
|
249
249
|
CatalogEntry *Catalog::CreateCollation(CatalogTransaction transaction, CreateCollationInfo *info) {
|
250
250
|
auto schema = GetSchema(transaction, info->schema);
|
251
|
-
return CreateCollation(transaction, schema, info);
|
251
|
+
return CreateCollation(transaction, *schema, info);
|
252
252
|
}
|
253
253
|
|
254
254
|
CatalogEntry *Catalog::CreateCollation(ClientContext &context, CreateCollationInfo *info) {
|
255
255
|
return CreateCollation(GetCatalogTransaction(context), info);
|
256
256
|
}
|
257
257
|
|
258
|
-
CatalogEntry *Catalog::CreateCollation(CatalogTransaction transaction, SchemaCatalogEntry
|
258
|
+
CatalogEntry *Catalog::CreateCollation(CatalogTransaction transaction, SchemaCatalogEntry &schema,
|
259
259
|
CreateCollationInfo *info) {
|
260
|
-
return schema
|
260
|
+
return schema.CreateCollation(transaction, info);
|
261
261
|
}
|
262
262
|
|
263
263
|
//===--------------------------------------------------------------------===//
|
@@ -64,10 +64,10 @@ void FindForeignKeyInformation(CatalogEntry &entry, AlterForeignKeyType alter_fk
|
|
64
64
|
|
65
65
|
DuckSchemaEntry::DuckSchemaEntry(Catalog *catalog, string name_p, bool is_internal)
|
66
66
|
: SchemaCatalogEntry(catalog, std::move(name_p), is_internal),
|
67
|
-
tables(*catalog, make_uniq<DefaultViewGenerator>(*catalog, this)), indexes(*catalog), table_functions(*catalog),
|
67
|
+
tables(*catalog, make_uniq<DefaultViewGenerator>(*catalog, *this)), indexes(*catalog), table_functions(*catalog),
|
68
68
|
copy_functions(*catalog), pragma_functions(*catalog),
|
69
|
-
functions(*catalog, make_uniq<DefaultFunctionGenerator>(*catalog, this)), sequences(*catalog),
|
70
|
-
collations(*catalog), types(*catalog, make_uniq<DefaultTypeGenerator>(*catalog, this)) {
|
69
|
+
functions(*catalog, make_uniq<DefaultFunctionGenerator>(*catalog, *this)), sequences(*catalog),
|
70
|
+
collations(*catalog), types(*catalog, make_uniq<DefaultTypeGenerator>(*catalog, *this)) {
|
71
71
|
}
|
72
72
|
|
73
73
|
CatalogEntry *DuckSchemaEntry::AddEntryInternal(CatalogTransaction transaction, unique_ptr<StandardEntry> entry,
|
@@ -78,7 +78,7 @@ CatalogEntry *DuckSchemaEntry::AddEntryInternal(CatalogTransaction transaction,
|
|
78
78
|
|
79
79
|
// first find the set for this entry
|
80
80
|
auto &set = GetCatalogSet(entry_type);
|
81
|
-
dependencies.AddDependency(this);
|
81
|
+
dependencies.AddDependency(*this);
|
82
82
|
if (on_conflict == OnCreateConflict::REPLACE_ON_CONFLICT) {
|
83
83
|
// CREATE OR REPLACE: first try to drop the entry
|
84
84
|
auto old_entry = set.GetEntry(transaction, entry_name);
|
@@ -122,7 +122,7 @@ CatalogEntry *DuckSchemaEntry::CreateTable(CatalogTransaction transaction, Bound
|
|
122
122
|
|
123
123
|
// make a dependency between this table and referenced table
|
124
124
|
auto &set = GetCatalogSet(CatalogType::TABLE_ENTRY);
|
125
|
-
info->dependencies.AddDependency(set.GetEntry(transaction, fk_info->name));
|
125
|
+
info->dependencies.AddDependency(*set.GetEntry(transaction, fk_info->name));
|
126
126
|
}
|
127
127
|
return entry;
|
128
128
|
}
|
@@ -194,7 +194,7 @@ CatalogEntry *DuckSchemaEntry::CreateView(CatalogTransaction transaction, Create
|
|
194
194
|
|
195
195
|
CatalogEntry *DuckSchemaEntry::CreateIndex(ClientContext &context, CreateIndexInfo *info, TableCatalogEntry *table) {
|
196
196
|
DependencyList dependencies;
|
197
|
-
dependencies.AddDependency(table);
|
197
|
+
dependencies.AddDependency(*table);
|
198
198
|
auto index = make_uniq<DuckIndexEntry>(catalog, this, info);
|
199
199
|
return AddEntryInternal(GetCatalogTransaction(context), std::move(index), info->on_conflict, dependencies);
|
200
200
|
}
|
@@ -136,7 +136,7 @@ bool CatalogSet::CreateEntry(CatalogTransaction transaction, const string &name,
|
|
136
136
|
value->set = this;
|
137
137
|
|
138
138
|
// now add the dependency set of this object to the dependency manager
|
139
|
-
catalog.GetDependencyManager().AddObject(transaction, value
|
139
|
+
catalog.GetDependencyManager().AddObject(transaction, *value, dependencies);
|
140
140
|
|
141
141
|
auto value_ptr = value.get();
|
142
142
|
EntryIndex entry_index(*this, index);
|
@@ -196,7 +196,7 @@ bool CatalogSet::AlterOwnership(CatalogTransaction transaction, ChangeOwnershipI
|
|
196
196
|
return false;
|
197
197
|
}
|
198
198
|
|
199
|
-
catalog.GetDependencyManager().AddOwnership(transaction, owner_entry, entry);
|
199
|
+
catalog.GetDependencyManager().AddOwnership(transaction, *owner_entry, *entry);
|
200
200
|
|
201
201
|
return true;
|
202
202
|
}
|
@@ -272,7 +272,7 @@ bool CatalogSet::AlterEntry(CatalogTransaction transaction, const string &name,
|
|
272
272
|
// Note that we do this AFTER the new entry has been entirely set up in the catalog set
|
273
273
|
// that is because in case the alter fails because of a dependency conflict, we need to be able to cleanly roll back
|
274
274
|
// to the old entry.
|
275
|
-
catalog.GetDependencyManager().AlterObject(transaction, entry, new_entry);
|
275
|
+
catalog.GetDependencyManager().AlterObject(transaction, *entry, *new_entry);
|
276
276
|
|
277
277
|
return true;
|
278
278
|
}
|
@@ -287,7 +287,7 @@ void CatalogSet::DropEntryDependencies(CatalogTransaction transaction, EntryInde
|
|
287
287
|
|
288
288
|
// check any dependencies of this object
|
289
289
|
D_ASSERT(entry.catalog->IsDuckCatalog());
|
290
|
-
((DuckCatalog &)*entry.catalog).GetDependencyManager().DropObject(transaction,
|
290
|
+
((DuckCatalog &)*entry.catalog).GetDependencyManager().DropObject(transaction, entry, cascade);
|
291
291
|
|
292
292
|
// dropper destructor is called here
|
293
293
|
// the destructor makes sure to return the value to the previous state
|
@@ -350,7 +350,7 @@ void CatalogSet::CleanupEntry(CatalogEntry *catalog_entry) {
|
|
350
350
|
if (!catalog_entry->deleted) {
|
351
351
|
// delete the entry from the dependency manager, if it is not deleted yet
|
352
352
|
D_ASSERT(catalog_entry->catalog->IsDuckCatalog());
|
353
|
-
((DuckCatalog &)*catalog_entry->catalog).GetDependencyManager().EraseObject(catalog_entry);
|
353
|
+
((DuckCatalog &)*catalog_entry->catalog).GetDependencyManager().EraseObject(*catalog_entry);
|
354
354
|
}
|
355
355
|
auto parent = catalog_entry->parent;
|
356
356
|
parent->child = std::move(catalog_entry->child);
|
@@ -547,16 +547,18 @@ void CatalogSet::UpdateTimestamp(CatalogEntry &entry, transaction_t timestamp) {
|
|
547
547
|
}
|
548
548
|
|
549
549
|
void CatalogSet::AdjustUserDependency(CatalogEntry &entry, ColumnDefinition &column, bool remove) {
|
550
|
-
CatalogEntry *
|
551
|
-
if (
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
550
|
+
CatalogEntry *user_type_catalog_p = (CatalogEntry *)LogicalType::GetCatalog(column.Type());
|
551
|
+
if (!user_type_catalog_p) {
|
552
|
+
return;
|
553
|
+
}
|
554
|
+
auto &user_type_catalog = *user_type_catalog_p;
|
555
|
+
auto &dependency_manager = catalog.GetDependencyManager();
|
556
|
+
if (remove) {
|
557
|
+
dependency_manager.dependents_map[user_type_catalog].erase(*entry.parent);
|
558
|
+
dependency_manager.dependencies_map[*entry.parent].erase(user_type_catalog);
|
559
|
+
} else {
|
560
|
+
dependency_manager.dependents_map[user_type_catalog].insert(entry);
|
561
|
+
dependency_manager.dependencies_map[entry].insert(user_type_catalog);
|
560
562
|
}
|
561
563
|
}
|
562
564
|
|
@@ -613,35 +615,35 @@ void CatalogSet::Undo(CatalogEntry &entry) {
|
|
613
615
|
// and entry->parent has to be removed ("rolled back")
|
614
616
|
|
615
617
|
// i.e. we have to place (entry) as (entry->parent) again
|
616
|
-
auto &to_be_removed_node = entry.parent;
|
618
|
+
auto &to_be_removed_node = *entry.parent;
|
617
619
|
|
618
620
|
AdjustTableDependencies(entry);
|
619
621
|
|
620
|
-
if (!to_be_removed_node
|
622
|
+
if (!to_be_removed_node.deleted) {
|
621
623
|
// delete the entry from the dependency manager as well
|
622
624
|
auto &dependency_manager = catalog.GetDependencyManager();
|
623
625
|
dependency_manager.EraseObject(to_be_removed_node);
|
624
626
|
}
|
625
|
-
if (entry.name != to_be_removed_node
|
627
|
+
if (entry.name != to_be_removed_node.name) {
|
626
628
|
// rename: clean up the new name when the rename is rolled back
|
627
|
-
auto removed_entry = mapping.find(to_be_removed_node
|
629
|
+
auto removed_entry = mapping.find(to_be_removed_node.name);
|
628
630
|
if (removed_entry->second->child) {
|
629
631
|
removed_entry->second->child->parent = nullptr;
|
630
|
-
mapping[to_be_removed_node
|
632
|
+
mapping[to_be_removed_node.name] = std::move(removed_entry->second->child);
|
631
633
|
} else {
|
632
634
|
mapping.erase(removed_entry);
|
633
635
|
}
|
634
636
|
}
|
635
|
-
if (to_be_removed_node
|
637
|
+
if (to_be_removed_node.parent) {
|
636
638
|
// if the to be removed node has a parent, set the child pointer to the
|
637
639
|
// to be restored node
|
638
|
-
to_be_removed_node
|
639
|
-
entry.parent = to_be_removed_node
|
640
|
+
to_be_removed_node.parent->child = std::move(to_be_removed_node.child);
|
641
|
+
entry.parent = to_be_removed_node.parent;
|
640
642
|
} else {
|
641
643
|
// otherwise we need to update the base entry tables
|
642
644
|
auto &name = entry.name;
|
643
|
-
to_be_removed_node
|
644
|
-
mapping[name]->index.GetEntry() = std::move(to_be_removed_node
|
645
|
+
to_be_removed_node.child->SetAsRoot();
|
646
|
+
mapping[name]->index.GetEntry() = std::move(to_be_removed_node.child);
|
645
647
|
entry.parent = nullptr;
|
646
648
|
}
|
647
649
|
|
@@ -186,15 +186,15 @@ static unique_ptr<CreateFunctionInfo> GetDefaultFunction(const string &input_sch
|
|
186
186
|
return nullptr;
|
187
187
|
}
|
188
188
|
|
189
|
-
DefaultFunctionGenerator::DefaultFunctionGenerator(Catalog &catalog, SchemaCatalogEntry
|
189
|
+
DefaultFunctionGenerator::DefaultFunctionGenerator(Catalog &catalog, SchemaCatalogEntry &schema)
|
190
190
|
: DefaultGenerator(catalog), schema(schema) {
|
191
191
|
}
|
192
192
|
|
193
193
|
unique_ptr<CatalogEntry> DefaultFunctionGenerator::CreateDefaultEntry(ClientContext &context,
|
194
194
|
const string &entry_name) {
|
195
|
-
auto info = GetDefaultFunction(schema
|
195
|
+
auto info = GetDefaultFunction(schema.name, entry_name);
|
196
196
|
if (info) {
|
197
|
-
return make_uniq_base<CatalogEntry, ScalarMacroCatalogEntry>(&catalog, schema, (CreateMacroInfo *)info.get());
|
197
|
+
return make_uniq_base<CatalogEntry, ScalarMacroCatalogEntry>(&catalog, &schema, (CreateMacroInfo *)info.get());
|
198
198
|
}
|
199
199
|
return nullptr;
|
200
200
|
}
|
@@ -202,7 +202,7 @@ unique_ptr<CatalogEntry> DefaultFunctionGenerator::CreateDefaultEntry(ClientCont
|
|
202
202
|
vector<string> DefaultFunctionGenerator::GetDefaultEntries() {
|
203
203
|
vector<string> result;
|
204
204
|
for (idx_t index = 0; internal_macros[index].name != nullptr; index++) {
|
205
|
-
if (internal_macros[index].schema == schema
|
205
|
+
if (internal_macros[index].schema == schema.name) {
|
206
206
|
result.emplace_back(internal_macros[index].name);
|
207
207
|
}
|
208
208
|
}
|
@@ -94,12 +94,12 @@ LogicalTypeId DefaultTypeGenerator::GetDefaultType(const string &name) {
|
|
94
94
|
return LogicalTypeId::INVALID;
|
95
95
|
}
|
96
96
|
|
97
|
-
DefaultTypeGenerator::DefaultTypeGenerator(Catalog &catalog, SchemaCatalogEntry
|
97
|
+
DefaultTypeGenerator::DefaultTypeGenerator(Catalog &catalog, SchemaCatalogEntry &schema)
|
98
98
|
: DefaultGenerator(catalog), schema(schema) {
|
99
99
|
}
|
100
100
|
|
101
101
|
unique_ptr<CatalogEntry> DefaultTypeGenerator::CreateDefaultEntry(ClientContext &context, const string &entry_name) {
|
102
|
-
if (schema
|
102
|
+
if (schema.name != DEFAULT_SCHEMA) {
|
103
103
|
return nullptr;
|
104
104
|
}
|
105
105
|
auto type_id = GetDefaultType(entry_name);
|
@@ -111,12 +111,12 @@ unique_ptr<CatalogEntry> DefaultTypeGenerator::CreateDefaultEntry(ClientContext
|
|
111
111
|
info.type = LogicalType(type_id);
|
112
112
|
info.internal = true;
|
113
113
|
info.temporary = true;
|
114
|
-
return make_uniq_base<CatalogEntry, TypeCatalogEntry>(&catalog, schema, &info);
|
114
|
+
return make_uniq_base<CatalogEntry, TypeCatalogEntry>(&catalog, &schema, &info);
|
115
115
|
}
|
116
116
|
|
117
117
|
vector<string> DefaultTypeGenerator::GetDefaultEntries() {
|
118
118
|
vector<string> result;
|
119
|
-
if (schema
|
119
|
+
if (schema.name != DEFAULT_SCHEMA) {
|
120
120
|
return result;
|
121
121
|
}
|
122
122
|
for (idx_t index = 0; internal_types[index].name != nullptr; index++) {
|
@@ -69,14 +69,14 @@ static unique_ptr<CreateViewInfo> GetDefaultView(ClientContext &context, const s
|
|
69
69
|
return nullptr;
|
70
70
|
}
|
71
71
|
|
72
|
-
DefaultViewGenerator::DefaultViewGenerator(Catalog &catalog, SchemaCatalogEntry
|
72
|
+
DefaultViewGenerator::DefaultViewGenerator(Catalog &catalog, SchemaCatalogEntry &schema)
|
73
73
|
: DefaultGenerator(catalog), schema(schema) {
|
74
74
|
}
|
75
75
|
|
76
76
|
unique_ptr<CatalogEntry> DefaultViewGenerator::CreateDefaultEntry(ClientContext &context, const string &entry_name) {
|
77
|
-
auto info = GetDefaultView(context, schema
|
77
|
+
auto info = GetDefaultView(context, schema.name, entry_name);
|
78
78
|
if (info) {
|
79
|
-
return make_uniq_base<CatalogEntry, ViewCatalogEntry>(&catalog, schema, info.get());
|
79
|
+
return make_uniq_base<CatalogEntry, ViewCatalogEntry>(&catalog, &schema, info.get());
|
80
80
|
}
|
81
81
|
return nullptr;
|
82
82
|
}
|
@@ -84,7 +84,7 @@ unique_ptr<CatalogEntry> DefaultViewGenerator::CreateDefaultEntry(ClientContext
|
|
84
84
|
vector<string> DefaultViewGenerator::GetDefaultEntries() {
|
85
85
|
vector<string> result;
|
86
86
|
for (idx_t index = 0; internal_views[index].name != nullptr; index++) {
|
87
|
-
if (internal_views[index].schema == schema
|
87
|
+
if (internal_views[index].schema == schema.name) {
|
88
88
|
result.emplace_back(internal_views[index].name);
|
89
89
|
}
|
90
90
|
}
|
@@ -4,20 +4,21 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
-
void DependencyList::AddDependency(CatalogEntry
|
8
|
-
if (entry
|
7
|
+
void DependencyList::AddDependency(CatalogEntry &entry) {
|
8
|
+
if (entry.internal) {
|
9
9
|
return;
|
10
10
|
}
|
11
11
|
set.insert(entry);
|
12
12
|
}
|
13
13
|
|
14
|
-
void DependencyList::VerifyDependencies(Catalog
|
15
|
-
for (auto &
|
16
|
-
|
14
|
+
void DependencyList::VerifyDependencies(Catalog &catalog, const string &name) {
|
15
|
+
for (auto &dep_entry : set) {
|
16
|
+
auto &dep = dep_entry.get();
|
17
|
+
if (dep.catalog != &catalog) {
|
17
18
|
throw DependencyException(
|
18
19
|
"Error adding dependency for object \"%s\" - dependency \"%s\" is in catalog "
|
19
20
|
"\"%s\", which does not match the catalog \"%s\".\nCross catalog dependencies are not supported.",
|
20
|
-
name, dep
|
21
|
+
name, dep.name, dep.catalog->GetName(), catalog.GetName());
|
21
22
|
}
|
22
23
|
}
|
23
24
|
}
|