Skip to content

Commit 3e5d5fa

Browse files
committed
vendor: Update vendored sources to duckdb/duckdb@bbdc794
Merge v1.2.2 into main (duckdb/duckdb#17037)
1 parent 7fb5840 commit 3e5d5fa

File tree

13 files changed

+84
-34
lines changed

13 files changed

+84
-34
lines changed

src/duckdb/src/common/exception.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ FatalException::FatalException(ExceptionType type, const string &msg) : Exceptio
334334

335335
InternalException::InternalException(const string &msg) : Exception(ExceptionType::INTERNAL, msg) {
336336
#ifdef DUCKDB_CRASH_ON_ASSERT
337-
Printer::Print("ABORT THROWN BY INTERNAL EXCEPTION: " + msg);
338-
Printer::Print(StackTrace::GetStackTrace());
337+
Printer::Print("ABORT THROWN BY INTERNAL EXCEPTION: " + msg + "\n" + StackTrace::GetStackTrace());
339338
abort();
340339
#endif
341340
}

src/duckdb/src/common/printer.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ void Printer::RawPrint(OutputStream stream, const string &str) {
3030
#endif
3131
}
3232

33-
// LCOV_EXCL_START
34-
void Printer::Print(OutputStream stream, const string &str) {
33+
void Printer::DefaultLinePrint(OutputStream stream, const string &str) {
3534
Printer::RawPrint(stream, str);
3635
Printer::RawPrint(stream, "\n");
3736
}
37+
38+
line_printer_f Printer::line_printer = Printer::DefaultLinePrint;
39+
40+
// LCOV_EXCL_START
41+
void Printer::Print(OutputStream stream, const string &str) {
42+
Printer::line_printer(stream, str);
43+
}
3844
void Printer::Flush(OutputStream stream) {
3945
#ifndef DUCKDB_DISABLE_PRINT
4046
fflush(stream == OutputStream::STREAM_STDERR ? stderr : stdout);

src/duckdb/src/execution/operator/persistent/physical_insert.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static idx_t PerformOnConflictAction(InsertLocalState &lstate, InsertGlobalState
276276
}
277277
auto &local_storage = LocalStorage::Get(context.client, data_table.db);
278278
if (gstate.initialized) {
279-
// Flush the data first, it might be referenced by the Update
279+
// Flush any local appends that could be referenced by the UPDATE.
280280
data_table.FinalizeLocalAppend(gstate.append_state);
281281
gstate.initialized = false;
282282
}
@@ -289,6 +289,11 @@ static idx_t PerformOnConflictAction(InsertLocalState &lstate, InsertGlobalState
289289
data_table.Delete(delete_state, context.client, row_ids, update_chunk.size());
290290
} else {
291291
auto &local_storage = LocalStorage::Get(context.client, data_table.db);
292+
if (gstate.initialized) {
293+
// Flush any local appends that could be referenced by the DELETE.
294+
data_table.FinalizeLocalAppend(gstate.append_state);
295+
gstate.initialized = false;
296+
}
292297
local_storage.Delete(data_table, row_ids, update_chunk.size());
293298
}
294299

src/duckdb/src/function/table/version/pragma_version.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev2271"
2+
#define DUCKDB_PATCH_VERSION "0-dev2337"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 3
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.3.0-dev2271"
11+
#define DUCKDB_VERSION "v1.3.0-dev2337"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "5141aa4560"
14+
#define DUCKDB_SOURCE_ID "bbdc794b99"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/common/printer.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ namespace duckdb {
1515

1616
enum class OutputStream : uint8_t { STREAM_STDOUT = 1, STREAM_STDERR = 2 };
1717

18+
typedef void (*line_printer_f)(OutputStream stream, const string &str);
19+
1820
//! Printer is a static class that allows printing to logs or stdout/stderr
1921
class Printer {
2022
public:
@@ -40,5 +42,11 @@ class Printer {
4042
DUCKDB_API static bool IsTerminal(OutputStream stream);
4143
//! The terminal width
4244
DUCKDB_API static idx_t TerminalWidth();
45+
46+
// hook to allow capturing the output and routing it somewhere else / reformat it};
47+
static line_printer_f line_printer;
48+
49+
private:
50+
static void DefaultLinePrint(OutputStream stream, const string &str);
4351
};
4452
} // namespace duckdb

src/duckdb/src/include/duckdb/main/client_context_state.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "duckdb/common/optional_ptr.hpp"
1414
#include "duckdb/main/config.hpp"
1515
#include "duckdb/main/valid_checker.hpp"
16+
#include "duckdb/planner/expression/bound_parameter_data.hpp"
1617
#include "duckdb/transaction/meta_transaction.hpp"
1718
#include "duckdb/transaction/transaction_manager.hpp"
1819
#include "duckdb/main/database_manager.hpp"
@@ -39,6 +40,11 @@ struct PreparedStatementCallbackInfo {
3940
const PendingQueryParameters &parameters;
4041
};
4142

43+
struct BindPreparedStatementCallbackInfo {
44+
PreparedStatementData &prepared_statement;
45+
optional_ptr<case_insensitive_map_t<BoundParameterData>> parameters;
46+
};
47+
4248
//! ClientContextState is virtual base class for ClientContext-local (or Query-Local, using QueryEnd callback) state
4349
//! e.g. caches that need to live as long as a ClientContext or Query.
4450
class ClientContextState {
@@ -78,6 +84,10 @@ class ClientContextState {
7884
RebindQueryInfo current_rebind) {
7985
return RebindQueryInfo::DO_NOT_REBIND;
8086
}
87+
virtual RebindQueryInfo OnRebindPreparedStatement(ClientContext &context, BindPreparedStatementCallbackInfo &info,
88+
RebindQueryInfo current_rebind) {
89+
return RebindQueryInfo::DO_NOT_REBIND;
90+
}
8191
virtual void WriteProfilingInformation(std::ostream &ss) {
8292
}
8393
virtual void OnTaskStart(ClientContext &context) {

src/duckdb/src/include/duckdb/main/extension_entries.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
527527
{"sqlite_scan", "sqlite_scanner", CatalogType::TABLE_FUNCTION_ENTRY},
528528
{"sqlsmith", "sqlsmith", CatalogType::TABLE_FUNCTION_ENTRY},
529529
{"sqrt", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY},
530+
{"st_affine", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
530531
{"st_area", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
531532
{"st_area_spheroid", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
532533
{"st_asgeojson", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -536,13 +537,20 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
536537
{"st_aswkb", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
537538
{"st_boundary", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
538539
{"st_buffer", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
540+
{"st_buildarea", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
539541
{"st_centroid", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
540542
{"st_collect", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
541543
{"st_collectionextract", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
542544
{"st_concavehull", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
543545
{"st_contains", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
544546
{"st_containsproperly", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
545547
{"st_convexhull", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
548+
{"st_coverageinvalidedges", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
549+
{"st_coverageinvalidedges_agg", "spatial", CatalogType::AGGREGATE_FUNCTION_ENTRY},
550+
{"st_coveragesimplify", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
551+
{"st_coveragesimplify_agg", "spatial", CatalogType::AGGREGATE_FUNCTION_ENTRY},
552+
{"st_coverageunion", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
553+
{"st_coverageunion_agg", "spatial", CatalogType::AGGREGATE_FUNCTION_ENTRY},
546554
{"st_coveredby", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
547555
{"st_covers", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
548556
{"st_crosses", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -600,12 +608,14 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
600608
{"st_makeline", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
601609
{"st_makepolygon", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
602610
{"st_makevalid", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
611+
{"st_maximuminscribedcircle", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
603612
{"st_minimumrotatedrectangle", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
604613
{"st_mmax", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
605614
{"st_mmin", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
606615
{"st_multi", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
607616
{"st_ngeometries", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
608617
{"st_ninteriorrings", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
618+
{"st_node", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
609619
{"st_normalize", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
610620
{"st_npoints", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
611621
{"st_numgeometries", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -623,6 +633,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
623633
{"st_pointonsurface", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
624634
{"st_points", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
625635
{"st_polygon2dfromwkb", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
636+
{"st_polygonize", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
626637
{"st_quadkey", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
627638
{"st_read", "spatial", CatalogType::TABLE_FUNCTION_ENTRY},
628639
{"st_read_meta", "spatial", CatalogType::TABLE_FUNCTION_ENTRY},
@@ -631,12 +642,19 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = {
631642
{"st_reduceprecision", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
632643
{"st_removerepeatedpoints", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
633644
{"st_reverse", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
645+
{"st_rotate", "spatial", CatalogType::MACRO_ENTRY},
646+
{"st_rotatex", "spatial", CatalogType::MACRO_ENTRY},
647+
{"st_rotatey", "spatial", CatalogType::MACRO_ENTRY},
648+
{"st_rotatez", "spatial", CatalogType::MACRO_ENTRY},
649+
{"st_scale", "spatial", CatalogType::MACRO_ENTRY},
634650
{"st_shortestline", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
635651
{"st_simplify", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
636652
{"st_simplifypreservetopology", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
637653
{"st_startpoint", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
638654
{"st_touches", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
639655
{"st_transform", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
656+
{"st_translate", "spatial", CatalogType::MACRO_ENTRY},
657+
{"st_transscale", "spatial", CatalogType::MACRO_ENTRY},
640658
{"st_union", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
641659
{"st_union_agg", "spatial", CatalogType::AGGREGATE_FUNCTION_ENTRY},
642660
{"st_voronoidiagram", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY},
@@ -1075,6 +1093,7 @@ static constexpr ExtensionEntry EXTENSION_SECRET_PROVIDERS[] = {
10751093
{"s3/credential_chain", "aws"},
10761094
{"gcs/credential_chain", "aws"},
10771095
{"r2/credential_chain", "aws"},
1096+
{"aws/credential_chain", "aws"},
10781097
{"azure/access_token", "azure"},
10791098
{"azure/config", "azure"},
10801099
{"azure/credential_chain", "azure"},

src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class UniqueConstraint : public Constraint {
2222

2323
public:
2424
DUCKDB_API UniqueConstraint(const LogicalIndex index, const bool is_primary_key);
25+
DUCKDB_API UniqueConstraint(const LogicalIndex index, string column_name, const bool is_primary_key);
2526
DUCKDB_API UniqueConstraint(vector<string> columns, const bool is_primary_key);
2627

2728
public:
@@ -46,8 +47,6 @@ class UniqueConstraint : public Constraint {
4647
vector<LogicalIndex> GetLogicalIndexes(const ColumnList &columns) const;
4748
//! Get the name of the constraint.
4849
string GetName(const string &table_name) const;
49-
//! Sets a single column name. Does nothing, if the name is already set.
50-
void SetColumnName(const string &name);
5150

5251
private:
5352
UniqueConstraint();

src/duckdb/src/include/duckdb/planner/binder.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ class Binder : public enable_shared_from_this<Binder> {
143143
vector<unique_ptr<BoundConstraint>> BindConstraints(const TableCatalogEntry &table);
144144
vector<unique_ptr<BoundConstraint>> BindNewConstraints(vector<unique_ptr<Constraint>> &constraints,
145145
const string &table_name, const ColumnList &columns);
146-
unique_ptr<BoundConstraint> BindConstraint(Constraint &constraint, const string &table, const ColumnList &columns);
147-
unique_ptr<BoundConstraint> BindUniqueConstraint(Constraint &constraint, const string &table,
146+
unique_ptr<BoundConstraint> BindConstraint(const Constraint &constraint, const string &table,
147+
const ColumnList &columns);
148+
unique_ptr<BoundConstraint> BindUniqueConstraint(const Constraint &constraint, const string &table,
148149
const ColumnList &columns);
149150

150151
BoundStatement BindAlterAddIndex(BoundStatement &result, CatalogEntry &entry, unique_ptr<AlterInfo> alter_info);

src/duckdb/src/parser/constraints/unique_constraint.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ UniqueConstraint::UniqueConstraint() : Constraint(ConstraintType::UNIQUE), index
1010
UniqueConstraint::UniqueConstraint(const LogicalIndex index, const bool is_primary_key)
1111
: Constraint(ConstraintType::UNIQUE), index(index), is_primary_key(is_primary_key) {
1212
}
13+
UniqueConstraint::UniqueConstraint(const LogicalIndex index, string column_name_p, const bool is_primary_key)
14+
: UniqueConstraint(index, is_primary_key) {
15+
columns.push_back(std::move(column_name_p));
16+
}
1317

1418
UniqueConstraint::UniqueConstraint(vector<string> columns, const bool is_primary_key)
1519
: Constraint(ConstraintType::UNIQUE), index(DConstants::INVALID_INDEX), columns(std::move(columns)),
@@ -32,10 +36,7 @@ unique_ptr<Constraint> UniqueConstraint::Copy() const {
3236
return make_uniq<UniqueConstraint>(columns, is_primary_key);
3337
}
3438

35-
auto result = make_uniq<UniqueConstraint>(index, is_primary_key);
36-
if (!columns.empty()) {
37-
result->columns.push_back(columns[0]);
38-
}
39+
auto result = make_uniq<UniqueConstraint>(index, columns.empty() ? string() : columns[0], is_primary_key);
3940
return std::move(result);
4041
}
4142

@@ -95,11 +96,4 @@ string UniqueConstraint::GetName(const string &table_name) const {
9596
return type_name + "_" + table_name + name;
9697
}
9798

98-
void UniqueConstraint::SetColumnName(const string &column_name) {
99-
if (!columns.empty()) {
100-
return;
101-
}
102-
columns.push_back(column_name);
103-
}
104-
10599
} // namespace duckdb

src/duckdb/src/parser/transform/constraint/transform_constraint.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ unique_ptr<Constraint> Transformer::TransformConstraint(duckdb_libpgquery::PGCon
105105
case duckdb_libpgquery::PG_CONSTR_CHECK:
106106
return TransformConstraint(constraint);
107107
case duckdb_libpgquery::PG_CONSTR_PRIMARY:
108-
return make_uniq<UniqueConstraint>(LogicalIndex(index), true);
108+
return make_uniq<UniqueConstraint>(LogicalIndex(index), column.GetName(), true);
109109
case duckdb_libpgquery::PG_CONSTR_UNIQUE:
110-
return make_uniq<UniqueConstraint>(LogicalIndex(index), false);
110+
return make_uniq<UniqueConstraint>(LogicalIndex(index), column.GetName(), false);
111111
case duckdb_libpgquery::PG_CONSTR_NULL:
112112
return nullptr;
113113
case duckdb_libpgquery::PG_CONSTR_GENERATED_VIRTUAL: {

src/duckdb/src/planner/binder/statement/bind_create_table.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ vector<unique_ptr<BoundConstraint>> Binder::BindNewConstraints(vector<unique_ptr
102102
return bound_constraints;
103103
}
104104

105-
unique_ptr<BoundConstraint> BindCheckConstraint(Binder &binder, Constraint &constraint, const string &table,
105+
unique_ptr<BoundConstraint> BindCheckConstraint(Binder &binder, const Constraint &constraint, const string &table,
106106
const ColumnList &columns) {
107107
auto bound_constraint = make_uniq<BoundCheckConstraint>();
108108
auto &bound_check = bound_constraint->Cast<BoundCheckConstraint>();
@@ -112,15 +112,14 @@ unique_ptr<BoundConstraint> BindCheckConstraint(Binder &binder, Constraint &cons
112112
auto &check = constraint.Cast<CheckConstraint>();
113113

114114
// Create a copy of the unbound expression because binding can invalidate it.
115-
auto unbound_expression = check.expression->Copy();
115+
auto check_copy = check.expression->Copy();
116116

117117
// Bind the constraint and reset the original expression.
118-
bound_check.expression = check_binder.Bind(check.expression);
119-
check.expression = std::move(unbound_expression);
118+
bound_check.expression = check_binder.Bind(check_copy);
120119
return std::move(bound_constraint);
121120
}
122121

123-
unique_ptr<BoundConstraint> Binder::BindUniqueConstraint(Constraint &constraint, const string &table,
122+
unique_ptr<BoundConstraint> Binder::BindUniqueConstraint(const Constraint &constraint, const string &table,
124123
const ColumnList &columns) {
125124
auto &unique = constraint.Cast<UniqueConstraint>();
126125

@@ -132,7 +131,6 @@ unique_ptr<BoundConstraint> Binder::BindUniqueConstraint(Constraint &constraint,
132131
// If set, then the UNIQUE constraint is defined on a single column.
133132
if (unique.HasIndex()) {
134133
auto &col = columns.GetColumn(unique.GetIndex());
135-
unique.SetColumnName(col.Name());
136134
indexes.push_back(col.Physical());
137135
index_set.insert(col.Physical());
138136
return make_uniq<BoundUniqueConstraint>(std::move(indexes), std::move(index_set), unique.IsPrimaryKey());
@@ -159,7 +157,7 @@ unique_ptr<BoundConstraint> Binder::BindUniqueConstraint(Constraint &constraint,
159157
return make_uniq<BoundUniqueConstraint>(std::move(indexes), std::move(index_set), unique.IsPrimaryKey());
160158
}
161159

162-
unique_ptr<BoundConstraint> BindForeignKey(Constraint &constraint) {
160+
unique_ptr<BoundConstraint> BindForeignKey(const Constraint &constraint) {
163161
auto &fk = constraint.Cast<ForeignKeyConstraint>();
164162
D_ASSERT((fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE && !fk.info.pk_keys.empty()) ||
165163
(fk.info.type == ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE && !fk.info.pk_keys.empty()) ||
@@ -184,7 +182,7 @@ unique_ptr<BoundConstraint> BindForeignKey(Constraint &constraint) {
184182
return make_uniq<BoundForeignKeyConstraint>(fk.info, std::move(pk_key_set), std::move(fk_key_set));
185183
}
186184

187-
unique_ptr<BoundConstraint> Binder::BindConstraint(Constraint &constraint, const string &table,
185+
unique_ptr<BoundConstraint> Binder::BindConstraint(const Constraint &constraint, const string &table,
188186
const ColumnList &columns) {
189187
switch (constraint.type) {
190188
case ConstraintType::CHECK: {

src/duckdb/src/planner/binder/statement/bind_execute.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,18 @@ BoundStatement Binder::Bind(ExecuteStatement &stmt) {
6161
}
6262
unique_ptr<LogicalOperator> rebound_plan;
6363

64-
if (prepared->RequireRebind(context, &bind_values)) {
64+
RebindQueryInfo rebind = RebindQueryInfo::DO_NOT_REBIND;
65+
if (prepared->RequireRebind(context, bind_values)) {
66+
rebind = RebindQueryInfo::ATTEMPT_TO_REBIND;
67+
}
68+
for (auto &state : context.registered_state->States()) {
69+
BindPreparedStatementCallbackInfo info {*prepared, bind_values};
70+
auto new_rebind = state->OnRebindPreparedStatement(context, info, rebind);
71+
if (new_rebind == RebindQueryInfo::ATTEMPT_TO_REBIND) {
72+
rebind = RebindQueryInfo::ATTEMPT_TO_REBIND;
73+
}
74+
}
75+
if (rebind == RebindQueryInfo::ATTEMPT_TO_REBIND) {
6576
// catalog was modified or statement does not have clear types: rebind the statement before running the execute
6677
Planner prepared_planner(context);
6778
prepared_planner.parameter_data = bind_values;

0 commit comments

Comments
 (0)