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.
Files changed (200) hide show
  1. package/package.json +1 -1
  2. package/src/connection.cpp +1 -1
  3. package/src/duckdb/extension/icu/icu-dateadd.cpp +3 -3
  4. package/src/duckdb/extension/icu/icu-datepart.cpp +3 -3
  5. package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
  6. package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
  7. package/src/duckdb/extension/icu/icu-extension.cpp +3 -3
  8. package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
  9. package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
  10. package/src/duckdb/extension/icu/icu-strptime.cpp +4 -4
  11. package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
  12. package/src/duckdb/extension/icu/icu-timebucket.cpp +1 -1
  13. package/src/duckdb/extension/icu/icu-timezone.cpp +4 -4
  14. package/src/duckdb/extension/json/json-extension.cpp +6 -6
  15. package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -8
  16. package/src/duckdb/src/catalog/catalog.cpp +166 -127
  17. package/src/duckdb/src/catalog/catalog_entry/copy_function_catalog_entry.cpp +3 -3
  18. package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
  19. package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +90 -82
  20. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +65 -67
  21. package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -3
  22. package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +4 -4
  23. package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +8 -8
  24. package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +10 -10
  25. package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +6 -6
  26. package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +6 -6
  27. package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +4 -4
  28. package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +9 -9
  29. package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +5 -5
  30. package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +23 -23
  31. package/src/duckdb/src/catalog/catalog_entry.cpp +27 -6
  32. package/src/duckdb/src/catalog/catalog_search_path.cpp +2 -2
  33. package/src/duckdb/src/catalog/catalog_set.cpp +84 -87
  34. package/src/duckdb/src/catalog/catalog_transaction.cpp +1 -1
  35. package/src/duckdb/src/catalog/default/default_functions.cpp +1 -1
  36. package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
  37. package/src/duckdb/src/catalog/default/default_types.cpp +1 -1
  38. package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
  39. package/src/duckdb/src/catalog/dependency_list.cpp +2 -2
  40. package/src/duckdb/src/catalog/dependency_manager.cpp +9 -10
  41. package/src/duckdb/src/catalog/duck_catalog.cpp +30 -26
  42. package/src/duckdb/src/catalog/similar_catalog_entry.cpp +1 -1
  43. package/src/duckdb/src/common/types.cpp +15 -27
  44. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +2 -2
  45. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +4 -3
  46. package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +19 -18
  47. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +5 -5
  48. package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
  49. package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +1 -1
  50. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +6 -5
  51. package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -1
  52. package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +1 -1
  53. package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +2 -2
  54. package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +4 -3
  55. package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +1 -1
  56. package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +1 -1
  57. package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
  58. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +1 -1
  59. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +4 -4
  60. package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +4 -3
  61. package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
  62. package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
  63. package/src/duckdb/src/execution/physical_plan/plan_update.cpp +1 -1
  64. package/src/duckdb/src/function/built_in_functions.cpp +10 -10
  65. package/src/duckdb/src/function/function_binder.cpp +3 -3
  66. package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +5 -6
  67. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -2
  68. package/src/duckdb/src/function/scalar/sequence/nextval.cpp +9 -8
  69. package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +6 -6
  70. package/src/duckdb/src/function/table/arrow.cpp +5 -5
  71. package/src/duckdb/src/function/table/system/duckdb_columns.cpp +8 -7
  72. package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +14 -14
  73. package/src/duckdb/src/function/table/system/duckdb_databases.cpp +2 -2
  74. package/src/duckdb/src/function/table/system/duckdb_functions.cpp +26 -25
  75. package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +13 -12
  76. package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +7 -7
  77. package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +8 -9
  78. package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -9
  79. package/src/duckdb/src/function/table/system/duckdb_types.cpp +13 -13
  80. package/src/duckdb/src/function/table/system/duckdb_views.cpp +11 -10
  81. package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
  82. package/src/duckdb/src/function/table/system/pragma_database_size.cpp +5 -5
  83. package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +3 -3
  84. package/src/duckdb/src/function/table/system/pragma_table_info.cpp +2 -2
  85. package/src/duckdb/src/function/table/table_scan.cpp +39 -37
  86. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  87. package/src/duckdb/src/function/udf_function.cpp +2 -2
  88. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +122 -81
  89. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +2 -3
  90. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/collate_catalog_entry.hpp +3 -3
  91. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp +1 -1
  92. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
  93. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +24 -20
  94. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -3
  95. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
  96. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
  97. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
  98. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
  99. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
  100. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +22 -17
  101. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
  102. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -1
  103. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
  104. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
  105. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -1
  106. package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
  107. package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +28 -7
  108. package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +20 -19
  109. package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -9
  110. package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +2 -1
  111. package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +10 -4
  112. package/src/duckdb/src/include/duckdb/common/enums/on_entry_not_found.hpp +17 -0
  113. package/src/duckdb/src/include/duckdb/common/types.hpp +3 -4
  114. package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -4
  115. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +3 -2
  116. package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +5 -4
  117. package/src/duckdb/src/include/duckdb/function/table_function.hpp +28 -15
  118. package/src/duckdb/src/include/duckdb/main/attached_database.hpp +2 -0
  119. package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
  120. package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -2
  121. package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +2 -0
  122. package/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +2 -2
  123. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +7 -5
  124. package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
  125. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +1 -1
  126. package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +1 -1
  127. package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +3 -2
  128. package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +5 -5
  129. package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +13 -0
  130. package/src/duckdb/src/include/duckdb/parser/tableref.hpp +5 -2
  131. package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
  132. package/src/duckdb/src/include/duckdb/planner/binder.hpp +2 -2
  133. package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -2
  134. package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +4 -7
  135. package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +1 -1
  136. package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +12 -0
  137. package/src/duckdb/src/main/attached_database.cpp +12 -6
  138. package/src/duckdb/src/main/capi/table_function-c.cpp +17 -16
  139. package/src/duckdb/src/main/client_context.cpp +12 -11
  140. package/src/duckdb/src/main/database_manager.cpp +13 -12
  141. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -2
  142. package/src/duckdb/src/parser/parsed_data/alter_info.cpp +3 -3
  143. package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +2 -2
  144. package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +2 -2
  145. package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +9 -9
  146. package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +2 -2
  147. package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +2 -2
  148. package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
  149. package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +2 -2
  150. package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -2
  151. package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +5 -1
  152. package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +1 -1
  153. package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
  154. package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +1 -1
  155. package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +26 -27
  156. package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +17 -17
  157. package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +9 -9
  158. package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +6 -6
  159. package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +6 -6
  160. package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +2 -2
  161. package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +21 -21
  162. package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +2 -3
  163. package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +33 -36
  164. package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +5 -5
  165. package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -23
  166. package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +4 -4
  167. package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +7 -7
  168. package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +23 -23
  169. package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +4 -4
  170. package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +14 -13
  171. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +36 -35
  172. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +3 -3
  173. package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
  174. package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +4 -4
  175. package/src/duckdb/src/planner/binder/statement/bind_export.cpp +10 -10
  176. package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +2 -2
  177. package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +4 -4
  178. package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +5 -4
  179. package/src/duckdb/src/planner/binder/statement/bind_update.cpp +1 -1
  180. package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +3 -3
  181. package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +10 -12
  182. package/src/duckdb/src/planner/binder.cpp +2 -2
  183. package/src/duckdb/src/planner/expression/bound_expression.cpp +11 -2
  184. package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +2 -5
  185. package/src/duckdb/src/planner/operator/logical_create.cpp +2 -1
  186. package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
  187. package/src/duckdb/src/planner/operator/logical_delete.cpp +2 -2
  188. package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
  189. package/src/duckdb/src/planner/operator/logical_insert.cpp +2 -7
  190. package/src/duckdb/src/planner/operator/logical_update.cpp +2 -6
  191. package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +2 -2
  192. package/src/duckdb/src/planner/pragma_handler.cpp +3 -4
  193. package/src/duckdb/src/storage/checkpoint_manager.cpp +46 -46
  194. package/src/duckdb/src/storage/data_table.cpp +3 -6
  195. package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
  196. package/src/duckdb/src/storage/wal_replay.cpp +28 -30
  197. package/src/duckdb/src/storage/write_ahead_log.cpp +8 -8
  198. package/src/duckdb/src/transaction/cleanup_state.cpp +1 -1
  199. package/src/duckdb/src/transaction/commit_state.cpp +3 -4
  200. package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
@@ -66,7 +66,7 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
66
66
  // extract a table or view from the catalog
67
67
  BindSchemaOrCatalog(ref.catalog_name, ref.schema_name);
68
68
  auto table_or_view = Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, ref.catalog_name, ref.schema_name,
69
- ref.table_name, true, error_context);
69
+ ref.table_name, OnEntryNotFound::RETURN_NULL, error_context);
70
70
  // we still didn't find the table
71
71
  if (GetBindingMode() == BindingMode::EXTRACT_NAMES) {
72
72
  if (!table_or_view || table_or_view->type == CatalogType::TABLE_ENTRY) {
@@ -111,7 +111,7 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
111
111
 
112
112
  // could not find an alternative: bind again to get the error
113
113
  table_or_view = Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, ref.catalog_name, ref.schema_name,
114
- ref.table_name, false, error_context);
114
+ ref.table_name, OnEntryNotFound::THROW_EXCEPTION, error_context);
115
115
  }
116
116
  switch (table_or_view->type) {
117
117
  case CatalogType::TABLE_ENTRY: {
@@ -140,7 +140,7 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
140
140
  auto logical_get = make_uniq<LogicalGet>(table_index, scan_function, std::move(bind_data),
141
141
  std::move(return_types), std::move(return_names));
142
142
  bind_context.AddBaseTable(table_index, alias, table_names, table_types, logical_get->column_ids,
143
- logical_get->GetTable());
143
+ logical_get->GetTable().get());
144
144
  return make_uniq_base<BoundTableRef, BoundBaseTableRef>(table, std::move(logical_get));
145
145
  }
146
146
  case CatalogType::VIEW_ENTRY: {
@@ -185,7 +185,7 @@ Binder::BindTableFunctionInternal(TableFunction &table_function, const string &f
185
185
  }
186
186
  // now add the table function to the bind context so its columns can be bound
187
187
  bind_context.AddTableFunction(bind_index, function_name, return_names, return_types, get->column_ids,
188
- get->GetTable());
188
+ get->GetTable().get());
189
189
  return std::move(get);
190
190
  }
191
191
 
@@ -205,16 +205,12 @@ unique_ptr<BoundTableRef> Binder::Bind(TableFunctionRef &ref) {
205
205
  D_ASSERT(ref.function->type == ExpressionType::FUNCTION);
206
206
  auto &fexpr = ref.function->Cast<FunctionExpression>();
207
207
 
208
- TableFunctionCatalogEntry *function = nullptr;
209
-
210
208
  // fetch the function from the catalog
211
- auto func_catalog = Catalog::GetEntry(context, CatalogType::TABLE_FUNCTION_ENTRY, fexpr.catalog, fexpr.schema,
212
- fexpr.function_name, false, error_context);
209
+ auto &func_catalog = Catalog::GetEntry(context, CatalogType::TABLE_FUNCTION_ENTRY, fexpr.catalog, fexpr.schema,
210
+ fexpr.function_name, error_context);
213
211
 
214
- if (func_catalog->type == CatalogType::TABLE_FUNCTION_ENTRY) {
215
- function = (TableFunctionCatalogEntry *)func_catalog;
216
- } else if (func_catalog->type == CatalogType::TABLE_MACRO_ENTRY) {
217
- auto macro_func = (TableMacroCatalogEntry *)func_catalog;
212
+ if (func_catalog.type == CatalogType::TABLE_MACRO_ENTRY) {
213
+ auto &macro_func = func_catalog.Cast<TableMacroCatalogEntry>();
218
214
  auto query_node = BindTableMacro(fexpr, macro_func, 0);
219
215
  D_ASSERT(query_node);
220
216
 
@@ -234,6 +230,8 @@ unique_ptr<BoundTableRef> Binder::Bind(TableFunctionRef &ref) {
234
230
  MoveCorrelatedExpressions(*result->binder);
235
231
  return std::move(result);
236
232
  }
233
+ D_ASSERT(func_catalog.type == CatalogType::TABLE_FUNCTION_ENTRY);
234
+ auto &function = func_catalog.Cast<TableFunctionCatalogEntry>();
237
235
 
238
236
  // evaluate the input parameters to the function
239
237
  vector<LogicalType> arguments;
@@ -241,18 +239,18 @@ unique_ptr<BoundTableRef> Binder::Bind(TableFunctionRef &ref) {
241
239
  named_parameter_map_t named_parameters;
242
240
  unique_ptr<BoundSubqueryRef> subquery;
243
241
  string error;
244
- if (!BindTableFunctionParameters(*function, fexpr.children, arguments, parameters, named_parameters, subquery,
242
+ if (!BindTableFunctionParameters(function, fexpr.children, arguments, parameters, named_parameters, subquery,
245
243
  error)) {
246
244
  throw BinderException(FormatError(ref, error));
247
245
  }
248
246
 
249
247
  // select the function based on the input parameters
250
248
  FunctionBinder function_binder(context);
251
- idx_t best_function_idx = function_binder.BindFunction(function->name, function->functions, arguments, error);
249
+ idx_t best_function_idx = function_binder.BindFunction(function.name, function.functions, arguments, error);
252
250
  if (best_function_idx == DConstants::INVALID_INDEX) {
253
251
  throw BinderException(FormatError(ref, error));
254
252
  }
255
- auto table_function = function->functions.GetFunctionByOffset(best_function_idx);
253
+ auto table_function = function.functions.GetFunctionByOffset(best_function_idx);
256
254
 
257
255
  // now check the named parameters
258
256
  BindNamedParameters(table_function.named_parameters, named_parameters, error_context, table_function.name);
@@ -357,10 +357,10 @@ bool Binder::HasMatchingBinding(const string &catalog_name, const string &schema
357
357
  if (!catalog_entry) {
358
358
  return false;
359
359
  }
360
- if (!catalog_name.empty() && catalog_entry->catalog->GetName() != catalog_name) {
360
+ if (!catalog_name.empty() && catalog_entry->catalog.GetName() != catalog_name) {
361
361
  return false;
362
362
  }
363
- if (!schema_name.empty() && catalog_entry->schema->name != schema_name) {
363
+ if (!schema_name.empty() && catalog_entry->schema.name != schema_name) {
364
364
  return false;
365
365
  }
366
366
  if (catalog_entry->name != table_name) {
@@ -2,8 +2,17 @@
2
2
 
3
3
  namespace duckdb {
4
4
 
5
- BoundExpression::BoundExpression(unique_ptr<Expression> expr)
6
- : ParsedExpression(ExpressionType::INVALID, ExpressionClass::BOUND_EXPRESSION), expr(std::move(expr)) {
5
+ BoundExpression::BoundExpression(unique_ptr<Expression> expr_p)
6
+ : ParsedExpression(ExpressionType::INVALID, ExpressionClass::BOUND_EXPRESSION), expr(std::move(expr_p)) {
7
+ this->alias = expr->alias;
8
+ }
9
+
10
+ unique_ptr<Expression> &BoundExpression::GetExpression(ParsedExpression &expr) {
11
+ auto &bound_expr = expr.Cast<BoundExpression>();
12
+ if (!bound_expr.expr) {
13
+ throw InternalException("BoundExpression::GetExpression called on empty bound expression");
14
+ }
15
+ return bound_expr.expr;
7
16
  }
8
17
 
9
18
  string BoundExpression::ToString() const {
@@ -38,12 +38,9 @@ unique_ptr<LogicalOperator> LogicalCopyToFile::Deserialize(LogicalDeserializatio
38
38
  auto has_bind_data = reader.ReadRequired<bool>();
39
39
 
40
40
  auto &context = state.gstate.context;
41
- auto copy_func_catalog_entry =
41
+ auto &copy_func_catalog_entry =
42
42
  Catalog::GetEntry<CopyFunctionCatalogEntry>(context, INVALID_CATALOG, DEFAULT_SCHEMA, copy_func_name);
43
- if (!copy_func_catalog_entry) {
44
- throw InternalException("Cant find catalog entry for function %s", copy_func_name);
45
- }
46
- CopyFunction copy_func = copy_func_catalog_entry->function;
43
+ auto &copy_func = copy_func_catalog_entry.function;
47
44
 
48
45
  unique_ptr<FunctionData> bind_data;
49
46
  if (has_bind_data) {
@@ -10,7 +10,8 @@ unique_ptr<LogicalOperator> LogicalCreate::Deserialize(LogicalDeserializationSta
10
10
  auto &context = state.gstate.context;
11
11
  auto info = CreateInfo::Deserialize(reader.GetSource());
12
12
 
13
- auto schema_catalog_entry = Catalog::GetSchema(context, INVALID_CATALOG, info->schema, true);
13
+ auto schema_catalog_entry =
14
+ Catalog::GetSchema(context, INVALID_CATALOG, info->schema, OnEntryNotFound::RETURN_NULL);
14
15
  return make_uniq<LogicalCreate>(state.type, std::move(info), schema_catalog_entry);
15
16
  }
16
17
 
@@ -21,7 +21,7 @@ unique_ptr<LogicalOperator> LogicalCreateIndex::Deserialize(LogicalDeserializati
21
21
  auto &context = state.gstate.context;
22
22
  auto catalog_info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
23
23
 
24
- auto table =
24
+ auto &table =
25
25
  Catalog::GetEntry<TableCatalogEntry>(context, INVALID_CATALOG, catalog_info->schema, catalog_info->table);
26
26
  auto unbound_expressions = reader.ReadRequiredSerializableList<Expression>(state.gstate);
27
27
 
@@ -42,7 +42,7 @@ unique_ptr<LogicalOperator> LogicalCreateIndex::Deserialize(LogicalDeserializati
42
42
  reader, state.gstate, CatalogType::TABLE_FUNCTION_ENTRY, bind_data, has_deserialize);
43
43
 
44
44
  reader.Finalize();
45
- return make_uniq<LogicalCreateIndex>(std::move(bind_data), std::move(info), std::move(unbound_expressions), *table,
45
+ return make_uniq<LogicalCreateIndex>(std::move(bind_data), std::move(info), std::move(unbound_expressions), table,
46
46
  std::move(function));
47
47
  }
48
48
 
@@ -19,11 +19,11 @@ unique_ptr<LogicalOperator> LogicalDelete::Deserialize(LogicalDeserializationSta
19
19
  auto &context = state.gstate.context;
20
20
  auto info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
21
21
 
22
- auto table_catalog_entry =
22
+ auto &table_catalog_entry =
23
23
  Catalog::GetEntry<TableCatalogEntry>(context, INVALID_CATALOG, info->schema, info->table);
24
24
 
25
25
  auto table_index = reader.ReadRequired<idx_t>();
26
- auto result = make_uniq<LogicalDelete>(*table_catalog_entry, table_index);
26
+ auto result = make_uniq<LogicalDelete>(table_catalog_entry, table_index);
27
27
  result->return_chunk = reader.ReadRequired<bool>();
28
28
  return std::move(result);
29
29
  }
@@ -20,7 +20,7 @@ string LogicalGet::GetName() const {
20
20
  return StringUtil::Upper(function.name);
21
21
  }
22
22
 
23
- TableCatalogEntry *LogicalGet::GetTable() const {
23
+ optional_ptr<TableCatalogEntry> LogicalGet::GetTable() const {
24
24
  return TableScanFunction::GetTableEntry(function, bind_data.get());
25
25
  }
26
26
 
@@ -43,13 +43,8 @@ unique_ptr<LogicalOperator> LogicalInsert::Deserialize(LogicalDeserializationSta
43
43
 
44
44
  auto &catalog = Catalog::GetCatalog(context, INVALID_CATALOG);
45
45
 
46
- auto table_catalog_entry = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
47
-
48
- if (!table_catalog_entry) {
49
- throw InternalException("Cant find catalog entry for table %s", info->table);
50
- }
51
-
52
- auto result = make_uniq<LogicalInsert>(*table_catalog_entry, table_index);
46
+ auto &table_catalog_entry = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
47
+ auto result = make_uniq<LogicalInsert>(table_catalog_entry, table_index);
53
48
  result->type = state.type;
54
49
  result->return_chunk = return_chunk;
55
50
  result->insert_values = std::move(insert_values);
@@ -23,12 +23,8 @@ unique_ptr<LogicalOperator> LogicalUpdate::Deserialize(LogicalDeserializationSta
23
23
  auto info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
24
24
  auto &catalog = Catalog::GetCatalog(context, INVALID_CATALOG);
25
25
 
26
- auto table_catalog_entry = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
27
- if (!table_catalog_entry) {
28
- throw InternalException("Cant find catalog entry for table %s", info->table);
29
- }
30
-
31
- auto result = make_uniq<LogicalUpdate>(*table_catalog_entry);
26
+ auto &table_catalog_entry = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
27
+ auto result = make_uniq<LogicalUpdate>(table_catalog_entry);
32
28
  result->table_index = reader.ReadRequired<idx_t>();
33
29
  result->return_chunk = reader.ReadRequired<bool>();
34
30
  result->columns = reader.ReadRequiredIndexList<PhysicalIndex>();
@@ -37,8 +37,8 @@ unique_ptr<BoundCreateTableInfo> BoundCreateTableInfo::Deserialize(Deserializer
37
37
  auto &context = state.context;
38
38
  auto create_info = SchemaCatalogEntry::Deserialize(source);
39
39
  auto schema_name = create_info->schema;
40
- auto schema = Catalog::GetSchema(context, INVALID_CATALOG, schema_name);
41
- auto result = make_uniq<BoundCreateTableInfo>(*schema, std::move(create_info));
40
+ auto &schema = Catalog::GetSchema(context, INVALID_CATALOG, schema_name);
41
+ auto result = make_uniq<BoundCreateTableInfo>(schema, std::move(create_info));
42
42
  result->base = source.ReadOptional<CreateInfo>();
43
43
 
44
44
  source.ReadList<Constraint>(result->constraints);
@@ -70,16 +70,15 @@ void PragmaHandler::HandlePragmaStatements(ClientContextLock &lock, vector<uniqu
70
70
 
71
71
  bool PragmaHandler::HandlePragma(SQLStatement *statement, string &resulting_query) { // PragmaInfo &info
72
72
  auto info = *(statement->Cast<PragmaStatement>()).info;
73
- auto entry =
74
- Catalog::GetEntry<PragmaFunctionCatalogEntry>(context, INVALID_CATALOG, DEFAULT_SCHEMA, info.name, false);
73
+ auto &entry = Catalog::GetEntry<PragmaFunctionCatalogEntry>(context, INVALID_CATALOG, DEFAULT_SCHEMA, info.name);
75
74
  string error;
76
75
 
77
76
  FunctionBinder function_binder(context);
78
- idx_t bound_idx = function_binder.BindFunction(entry->name, entry->functions, info, error);
77
+ idx_t bound_idx = function_binder.BindFunction(entry.name, entry.functions, info, error);
79
78
  if (bound_idx == DConstants::INVALID_INDEX) {
80
79
  throw BinderException(error);
81
80
  }
82
- auto bound_function = entry->functions.GetFunctionByOffset(bound_idx);
81
+ auto bound_function = entry.functions.GetFunctionByOffset(bound_idx);
83
82
  if (bound_function.query) {
84
83
  QueryErrorContext error_context(statement, statement->stmt_location);
85
84
  Binder::BindNamedParameters(bound_function.named_parameters, info.named_parameters, error_context,
@@ -71,15 +71,15 @@ void SingleFileCheckpointWriter::CreateCheckpoint() {
71
71
  // get the id of the first meta block
72
72
  block_id_t meta_block = metadata_writer->GetBlockPointer().block_id;
73
73
 
74
- vector<SchemaCatalogEntry *> schemas;
74
+ vector<reference<SchemaCatalogEntry>> schemas;
75
75
  // we scan the set of committed schemas
76
76
  auto &catalog = (DuckCatalog &)Catalog::GetCatalog(db);
77
- catalog.ScanSchemas([&](CatalogEntry *entry) { schemas.push_back((SchemaCatalogEntry *)entry); });
77
+ catalog.ScanSchemas([&](SchemaCatalogEntry &entry) { schemas.push_back(entry); });
78
78
  // write the actual data into the database
79
79
  // write the amount of schemas
80
80
  metadata_writer->Write<uint32_t>(schemas.size());
81
81
  for (auto &schema : schemas) {
82
- WriteSchema(*schema);
82
+ WriteSchema(schema.get());
83
83
  }
84
84
  partial_block_manager.FlushPartialBlocks();
85
85
  // flush the meta data to disk
@@ -150,58 +150,58 @@ void CheckpointWriter::WriteSchema(SchemaCatalogEntry &schema) {
150
150
  // then, we fetch the tables/views/sequences information
151
151
  vector<reference<TableCatalogEntry>> tables;
152
152
  vector<reference<ViewCatalogEntry>> views;
153
- schema.Scan(CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) {
154
- if (entry->internal) {
153
+ schema.Scan(CatalogType::TABLE_ENTRY, [&](CatalogEntry &entry) {
154
+ if (entry.internal) {
155
155
  return;
156
156
  }
157
- if (entry->type == CatalogType::TABLE_ENTRY) {
158
- tables.push_back(entry->Cast<TableCatalogEntry>());
159
- } else if (entry->type == CatalogType::VIEW_ENTRY) {
160
- views.push_back(entry->Cast<ViewCatalogEntry>());
157
+ if (entry.type == CatalogType::TABLE_ENTRY) {
158
+ tables.push_back(entry.Cast<TableCatalogEntry>());
159
+ } else if (entry.type == CatalogType::VIEW_ENTRY) {
160
+ views.push_back(entry.Cast<ViewCatalogEntry>());
161
161
  } else {
162
162
  throw NotImplementedException("Catalog type for entries");
163
163
  }
164
164
  });
165
165
  vector<reference<SequenceCatalogEntry>> sequences;
166
- schema.Scan(CatalogType::SEQUENCE_ENTRY, [&](CatalogEntry *entry) {
167
- if (entry->internal) {
166
+ schema.Scan(CatalogType::SEQUENCE_ENTRY, [&](CatalogEntry &entry) {
167
+ if (entry.internal) {
168
168
  return;
169
169
  }
170
- sequences.push_back(entry->Cast<SequenceCatalogEntry>());
170
+ sequences.push_back(entry.Cast<SequenceCatalogEntry>());
171
171
  });
172
172
 
173
173
  vector<reference<TypeCatalogEntry>> custom_types;
174
- schema.Scan(CatalogType::TYPE_ENTRY, [&](CatalogEntry *entry) {
175
- if (entry->internal) {
174
+ schema.Scan(CatalogType::TYPE_ENTRY, [&](CatalogEntry &entry) {
175
+ if (entry.internal) {
176
176
  return;
177
177
  }
178
- custom_types.push_back(entry->Cast<TypeCatalogEntry>());
178
+ custom_types.push_back(entry.Cast<TypeCatalogEntry>());
179
179
  });
180
180
 
181
181
  vector<reference<ScalarMacroCatalogEntry>> macros;
182
- schema.Scan(CatalogType::SCALAR_FUNCTION_ENTRY, [&](CatalogEntry *entry) {
183
- if (entry->internal) {
182
+ schema.Scan(CatalogType::SCALAR_FUNCTION_ENTRY, [&](CatalogEntry &entry) {
183
+ if (entry.internal) {
184
184
  return;
185
185
  }
186
- if (entry->type == CatalogType::MACRO_ENTRY) {
187
- macros.push_back(entry->Cast<ScalarMacroCatalogEntry>());
186
+ if (entry.type == CatalogType::MACRO_ENTRY) {
187
+ macros.push_back(entry.Cast<ScalarMacroCatalogEntry>());
188
188
  }
189
189
  });
190
190
 
191
191
  vector<reference<TableMacroCatalogEntry>> table_macros;
192
- schema.Scan(CatalogType::TABLE_FUNCTION_ENTRY, [&](CatalogEntry *entry) {
193
- if (entry->internal) {
192
+ schema.Scan(CatalogType::TABLE_FUNCTION_ENTRY, [&](CatalogEntry &entry) {
193
+ if (entry.internal) {
194
194
  return;
195
195
  }
196
- if (entry->type == CatalogType::TABLE_MACRO_ENTRY) {
197
- table_macros.push_back(entry->Cast<TableMacroCatalogEntry>());
196
+ if (entry.type == CatalogType::TABLE_MACRO_ENTRY) {
197
+ table_macros.push_back(entry.Cast<TableMacroCatalogEntry>());
198
198
  }
199
199
  });
200
200
 
201
201
  vector<reference<IndexCatalogEntry>> indexes;
202
- schema.Scan(CatalogType::INDEX_ENTRY, [&](CatalogEntry *entry) {
203
- D_ASSERT(!entry->internal);
204
- indexes.push_back(entry->Cast<IndexCatalogEntry>());
202
+ schema.Scan(CatalogType::INDEX_ENTRY, [&](CatalogEntry &entry) {
203
+ D_ASSERT(!entry.internal);
204
+ indexes.push_back(entry.Cast<IndexCatalogEntry>());
205
205
  });
206
206
 
207
207
  FieldWriter writer(GetMetaBlockWriter());
@@ -254,7 +254,7 @@ void CheckpointReader::ReadSchema(ClientContext &context, MetaBlockReader &reade
254
254
  auto info = SchemaCatalogEntry::Deserialize(reader);
255
255
  // we set create conflict to ignore to ignore the failure of recreating the main schema
256
256
  info->on_conflict = OnCreateConflict::IGNORE_ON_CONFLICT;
257
- catalog.CreateSchema(context, info.get());
257
+ catalog.CreateSchema(context, *info);
258
258
 
259
259
  // first read all the counts
260
260
  FieldReader field_reader(reader);
@@ -307,7 +307,7 @@ void CheckpointWriter::WriteView(ViewCatalogEntry &view) {
307
307
 
308
308
  void CheckpointReader::ReadView(ClientContext &context, MetaBlockReader &reader) {
309
309
  auto info = ViewCatalogEntry::Deserialize(reader, context);
310
- catalog.CreateView(context, info.get());
310
+ catalog.CreateView(context, *info);
311
311
  }
312
312
 
313
313
  //===--------------------------------------------------------------------===//
@@ -319,7 +319,7 @@ void CheckpointWriter::WriteSequence(SequenceCatalogEntry &seq) {
319
319
 
320
320
  void CheckpointReader::ReadSequence(ClientContext &context, MetaBlockReader &reader) {
321
321
  auto info = SequenceCatalogEntry::Deserialize(reader);
322
- catalog.CreateSequence(context, info.get());
322
+ catalog.CreateSequence(context, *info);
323
323
  }
324
324
 
325
325
  //===--------------------------------------------------------------------===//
@@ -342,11 +342,11 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
342
342
  auto info = IndexCatalogEntry::Deserialize(reader, context);
343
343
 
344
344
  // Create index in the catalog
345
- auto schema_catalog = catalog.GetSchema(context, info->schema);
346
- auto table_catalog =
347
- (DuckTableEntry *)catalog.GetEntry(context, CatalogType::TABLE_ENTRY, info->schema, info->table->table_name);
348
- auto index_catalog = (DuckIndexEntry *)schema_catalog->CreateIndex(context, info.get(), table_catalog);
349
- index_catalog->info = table_catalog->GetStorage().info;
345
+ auto &schema_catalog = catalog.GetSchema(context, info->schema);
346
+ auto &table_catalog = catalog.GetEntry(context, CatalogType::TABLE_ENTRY, info->schema, info->table->table_name)
347
+ .Cast<DuckTableEntry>();
348
+ auto &index_catalog = schema_catalog.CreateIndex(context, *info, table_catalog)->Cast<DuckIndexEntry>();
349
+ index_catalog.info = table_catalog.GetStorage().info;
350
350
  // Here we just gotta read the root node
351
351
  auto root_block_id = reader.Read<block_id_t>();
352
352
  auto root_offset = reader.Read<uint32_t>();
@@ -360,8 +360,8 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
360
360
  }
361
361
 
362
362
  auto binder = Binder::CreateBinder(context);
363
- auto table_ref = (TableRef *)info->table.get();
364
- auto bound_table = binder->Bind(*table_ref);
363
+ auto &table_ref = info->table->Cast<TableRef>();
364
+ auto bound_table = binder->Bind(table_ref);
365
365
  D_ASSERT(bound_table->type == TableReferenceType::BASE_TABLE);
366
366
  IndexBinder idx_binder(*binder, context);
367
367
  unbound_expressions.reserve(parsed_expressions.size());
@@ -374,7 +374,7 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
374
374
  // column refs
375
375
  unbound_expressions.reserve(info->column_ids.size());
376
376
  for (idx_t key_nr = 0; key_nr < info->column_ids.size(); key_nr++) {
377
- auto &col = table_catalog->GetColumn(LogicalIndex(info->column_ids[key_nr]));
377
+ auto &col = table_catalog.GetColumn(LogicalIndex(info->column_ids[key_nr]));
378
378
  unbound_expressions.push_back(
379
379
  make_uniq<BoundColumnRefExpression>(col.GetName(), col.GetType(), ColumnBinding(0, key_nr)));
380
380
  }
@@ -382,10 +382,10 @@ void CheckpointReader::ReadIndex(ClientContext &context, MetaBlockReader &reader
382
382
 
383
383
  switch (info->index_type) {
384
384
  case IndexType::ART: {
385
- auto &storage = table_catalog->GetStorage();
385
+ auto &storage = table_catalog.GetStorage();
386
386
  auto art = make_uniq<ART>(info->column_ids, TableIOManager::Get(storage), std::move(unbound_expressions),
387
387
  info->constraint_type, storage.db, true, root_block_id, root_offset);
388
- index_catalog->index = art.get();
388
+ index_catalog.index = art.get();
389
389
  storage.info->indexes.AddIndex(std::move(art));
390
390
  break;
391
391
  }
@@ -403,9 +403,9 @@ void CheckpointWriter::WriteType(TypeCatalogEntry &type) {
403
403
 
404
404
  void CheckpointReader::ReadType(ClientContext &context, MetaBlockReader &reader) {
405
405
  auto info = TypeCatalogEntry::Deserialize(reader);
406
- auto catalog_entry = (TypeCatalogEntry *)catalog.CreateType(context, info.get());
406
+ auto &catalog_entry = catalog.CreateType(context, *info)->Cast<TypeCatalogEntry>();
407
407
  if (info->type.id() == LogicalTypeId::ENUM) {
408
- EnumType::SetCatalog(info->type, catalog_entry);
408
+ EnumType::SetCatalog(info->type, &catalog_entry);
409
409
  }
410
410
  }
411
411
 
@@ -418,7 +418,7 @@ void CheckpointWriter::WriteMacro(ScalarMacroCatalogEntry &macro) {
418
418
 
419
419
  void CheckpointReader::ReadMacro(ClientContext &context, MetaBlockReader &reader) {
420
420
  auto info = ScalarMacroCatalogEntry::Deserialize(reader, context);
421
- catalog.CreateFunction(context, info.get());
421
+ catalog.CreateFunction(context, *info);
422
422
  }
423
423
 
424
424
  void CheckpointWriter::WriteTableMacro(TableMacroCatalogEntry &macro) {
@@ -427,7 +427,7 @@ void CheckpointWriter::WriteTableMacro(TableMacroCatalogEntry &macro) {
427
427
 
428
428
  void CheckpointReader::ReadTableMacro(ClientContext &context, MetaBlockReader &reader) {
429
429
  auto info = TableMacroCatalogEntry::Deserialize(reader, context);
430
- catalog.CreateFunction(context, info.get());
430
+ catalog.CreateFunction(context, *info);
431
431
  }
432
432
 
433
433
  //===--------------------------------------------------------------------===//
@@ -447,14 +447,14 @@ void CheckpointReader::ReadTable(ClientContext &context, MetaBlockReader &reader
447
447
  auto info = TableCatalogEntry::Deserialize(reader, context);
448
448
  // bind the info
449
449
  auto binder = Binder::CreateBinder(context);
450
- auto schema = catalog.GetSchema(context, info->schema);
451
- auto bound_info = binder->BindCreateTableInfo(std::move(info), *schema);
450
+ auto &schema = catalog.GetSchema(context, info->schema);
451
+ auto bound_info = binder->BindCreateTableInfo(std::move(info), schema);
452
452
 
453
453
  // now read the actual table data and place it into the create table info
454
454
  ReadTableData(context, reader, *bound_info);
455
455
 
456
456
  // finally create the table in the catalog
457
- catalog.CreateTable(context, bound_info.get());
457
+ catalog.CreateTable(context, *bound_info);
458
458
  }
459
459
 
460
460
  void CheckpointReader::ReadTableData(ClientContext &context, MetaBlockReader &reader,
@@ -397,14 +397,11 @@ void DataTable::VerifyForeignKeyConstraint(const BoundForeignKeyConstraint &bfk,
397
397
  dst_keys_ptr = &bfk.info.fk_keys;
398
398
  }
399
399
 
400
- auto table_entry_ptr =
400
+ auto &table_entry_ptr =
401
401
  Catalog::GetEntry<TableCatalogEntry>(context, INVALID_CATALOG, bfk.info.schema, bfk.info.table);
402
- if (table_entry_ptr == nullptr) {
403
- throw InternalException("Can't find table \"%s\" in foreign key constraint", bfk.info.table);
404
- }
405
402
  // make the data chunk to check
406
403
  vector<LogicalType> types;
407
- for (auto &col : table_entry_ptr->GetColumns().Physical()) {
404
+ for (auto &col : table_entry_ptr.GetColumns().Physical()) {
408
405
  types.emplace_back(col.Type());
409
406
  }
410
407
  DataChunk dst_chunk;
@@ -413,7 +410,7 @@ void DataTable::VerifyForeignKeyConstraint(const BoundForeignKeyConstraint &bfk,
413
410
  dst_chunk.data[(*dst_keys_ptr)[i].index].Reference(chunk.data[(*src_keys_ptr)[i].index]);
414
411
  }
415
412
  dst_chunk.SetCardinality(chunk.size());
416
- auto &data_table = table_entry_ptr->GetStorage();
413
+ auto &data_table = table_entry_ptr.GetStorage();
417
414
 
418
415
  idx_t count = dst_chunk.size();
419
416
  if (count <= 0) {
@@ -1138,7 +1138,7 @@ void UpdateSegment::Update(TransactionData transaction, idx_t column_index, Vect
1138
1138
  if (!node) {
1139
1139
  // no updates made yet by this transaction: initially the update info to empty
1140
1140
  if (transaction.transaction) {
1141
- auto &dtransaction = (DuckTransaction &)*transaction.transaction;
1141
+ auto &dtransaction = transaction.transaction->Cast<DuckTransaction>();
1142
1142
  node = dtransaction.CreateUpdateInfo(type_size, count);
1143
1143
  } else {
1144
1144
  node = CreateEmptyUpdateInfo(transaction, type_size, count, update_info_data);