duckdb 0.3.2-dev1323.0 → 0.3.2-dev1335.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.cpp +200 -91
- package/src/duckdb.hpp +13 -2
- package/src/parquet-amalgamation.cpp +36550 -36550
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -40015,7 +40015,7 @@ DistinctSelectGenericLoopSwitch(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restr
|
|
|
40015
40015
|
const SelectionVector *__restrict lsel, const SelectionVector *__restrict rsel,
|
|
40016
40016
|
const SelectionVector *__restrict result_sel, idx_t count, ValidityMask &lmask,
|
|
40017
40017
|
ValidityMask &rmask, SelectionVector *true_sel, SelectionVector *false_sel) {
|
|
40018
|
-
if (!lmask.AllValid() || rmask.AllValid()) {
|
|
40018
|
+
if (!lmask.AllValid() || !rmask.AllValid()) {
|
|
40019
40019
|
return DistinctSelectGenericLoopSelSwitch<LEFT_TYPE, RIGHT_TYPE, OP, DENSE, false>(
|
|
40020
40020
|
ldata, rdata, lsel, rsel, result_sel, count, lmask, rmask, true_sel, false_sel);
|
|
40021
40021
|
} else {
|
|
@@ -56738,6 +56738,7 @@ bool TopNHeap::CheckBoundaryValues(DataChunk &sort_chunk, DataChunk &payload) {
|
|
|
56738
56738
|
idx_t false_count = remaining_count - true_count;
|
|
56739
56739
|
if (false_count > 0) {
|
|
56740
56740
|
// check what we should continue to check
|
|
56741
|
+
compare_chunk.data[i].Slice(sort_chunk.data[i], false_sel, false_count);
|
|
56741
56742
|
remaining_count = VectorOperations::NotDistinctFrom(compare_chunk.data[i], boundary_values.data[i],
|
|
56742
56743
|
&false_sel, false_count, &new_remaining_sel, nullptr);
|
|
56743
56744
|
if (is_last) {
|
|
@@ -63535,11 +63536,14 @@ enum class ExplainType : uint8_t { EXPLAIN_STANDARD, EXPLAIN_ANALYZE };
|
|
|
63535
63536
|
|
|
63536
63537
|
class ExplainStatement : public SQLStatement {
|
|
63537
63538
|
public:
|
|
63538
|
-
ExplainStatement(unique_ptr<SQLStatement> stmt, ExplainType explain_type = ExplainType::EXPLAIN_STANDARD);
|
|
63539
|
+
explicit ExplainStatement(unique_ptr<SQLStatement> stmt, ExplainType explain_type = ExplainType::EXPLAIN_STANDARD);
|
|
63539
63540
|
|
|
63540
63541
|
unique_ptr<SQLStatement> stmt;
|
|
63541
63542
|
ExplainType explain_type;
|
|
63542
63543
|
|
|
63544
|
+
protected:
|
|
63545
|
+
ExplainStatement(const ExplainStatement &other);
|
|
63546
|
+
|
|
63543
63547
|
public:
|
|
63544
63548
|
unique_ptr<SQLStatement> Copy() const override;
|
|
63545
63549
|
};
|
|
@@ -89868,7 +89872,7 @@ void SystemFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
89868
89872
|
auto varchar_list_type = LogicalType::LIST(LogicalType::VARCHAR);
|
|
89869
89873
|
|
|
89870
89874
|
set.AddFunction(
|
|
89871
|
-
ScalarFunction("current_query", {}, LogicalType::VARCHAR, CurrentQueryFunction,
|
|
89875
|
+
ScalarFunction("current_query", {}, LogicalType::VARCHAR, CurrentQueryFunction, true, BindSystemFunction));
|
|
89872
89876
|
set.AddFunction(
|
|
89873
89877
|
ScalarFunction("current_schema", {}, LogicalType::VARCHAR, CurrentSchemaFunction, false, BindSystemFunction));
|
|
89874
89878
|
set.AddFunction(ScalarFunction("current_schemas", {LogicalType::BOOLEAN}, varchar_list_type, CurrentSchemasFunction,
|
|
@@ -98796,6 +98800,9 @@ public:
|
|
|
98796
98800
|
|
|
98797
98801
|
unique_ptr<DropInfo> info;
|
|
98798
98802
|
|
|
98803
|
+
protected:
|
|
98804
|
+
DropStatement(const DropStatement &other);
|
|
98805
|
+
|
|
98799
98806
|
public:
|
|
98800
98807
|
unique_ptr<SQLStatement> Copy() const override;
|
|
98801
98808
|
};
|
|
@@ -98825,6 +98832,9 @@ public:
|
|
|
98825
98832
|
string name;
|
|
98826
98833
|
vector<unique_ptr<ParsedExpression>> values;
|
|
98827
98834
|
|
|
98835
|
+
protected:
|
|
98836
|
+
ExecuteStatement(const ExecuteStatement &other);
|
|
98837
|
+
|
|
98828
98838
|
public:
|
|
98829
98839
|
unique_ptr<SQLStatement> Copy() const override;
|
|
98830
98840
|
};
|
|
@@ -98853,6 +98863,9 @@ public:
|
|
|
98853
98863
|
unique_ptr<SQLStatement> statement;
|
|
98854
98864
|
string name;
|
|
98855
98865
|
|
|
98866
|
+
protected:
|
|
98867
|
+
PrepareStatement(const PrepareStatement &other);
|
|
98868
|
+
|
|
98856
98869
|
public:
|
|
98857
98870
|
unique_ptr<SQLStatement> Copy() const override;
|
|
98858
98871
|
};
|
|
@@ -98938,6 +98951,9 @@ public:
|
|
|
98938
98951
|
|
|
98939
98952
|
shared_ptr<Relation> relation;
|
|
98940
98953
|
|
|
98954
|
+
protected:
|
|
98955
|
+
RelationStatement(const RelationStatement &other) = default;
|
|
98956
|
+
|
|
98941
98957
|
public:
|
|
98942
98958
|
unique_ptr<SQLStatement> Copy() const override;
|
|
98943
98959
|
};
|
|
@@ -98980,6 +98996,9 @@ public:
|
|
|
98980
98996
|
|
|
98981
98997
|
unique_ptr<PragmaInfo> info;
|
|
98982
98998
|
|
|
98999
|
+
protected:
|
|
99000
|
+
PragmaStatement(const PragmaStatement &other);
|
|
99001
|
+
|
|
98983
99002
|
public:
|
|
98984
99003
|
unique_ptr<SQLStatement> Copy() const override;
|
|
98985
99004
|
};
|
|
@@ -109274,23 +109293,25 @@ PreparedStatementData::~PreparedStatementData() {
|
|
|
109274
109293
|
|
|
109275
109294
|
void PreparedStatementData::Bind(vector<Value> values) {
|
|
109276
109295
|
// set parameters
|
|
109277
|
-
|
|
109296
|
+
const auto required = unbound_statement ? unbound_statement->n_param : 0;
|
|
109297
|
+
if (values.size() != required) {
|
|
109278
109298
|
throw BinderException("Parameter/argument count mismatch for prepared statement. Expected %llu, got %llu",
|
|
109279
|
-
|
|
109299
|
+
required, values.size());
|
|
109280
109300
|
}
|
|
109281
|
-
|
|
109282
|
-
|
|
109283
|
-
|
|
109284
|
-
|
|
109301
|
+
|
|
109302
|
+
// bind the required values
|
|
109303
|
+
for (auto &it : value_map) {
|
|
109304
|
+
const idx_t i = it.first - 1;
|
|
109305
|
+
if (i >= values.size()) {
|
|
109285
109306
|
throw BinderException("Could not find parameter with index %llu", i + 1);
|
|
109286
109307
|
}
|
|
109287
|
-
D_ASSERT(!it
|
|
109288
|
-
if (!values[i].TryCastAs(it
|
|
109308
|
+
D_ASSERT(!it.second.empty());
|
|
109309
|
+
if (!values[i].TryCastAs(it.second[0]->type())) {
|
|
109289
109310
|
throw BinderException(
|
|
109290
109311
|
"Type mismatch for binding parameter with index %llu, expected type %s but got type %s", i + 1,
|
|
109291
|
-
it
|
|
109312
|
+
it.second[0]->type().ToString().c_str(), values[i].type().ToString().c_str());
|
|
109292
109313
|
}
|
|
109293
|
-
for (auto &target : it
|
|
109314
|
+
for (auto &target : it.second) {
|
|
109294
109315
|
*target = values[i];
|
|
109295
109316
|
}
|
|
109296
109317
|
}
|
|
@@ -110543,6 +110564,9 @@ public:
|
|
|
110543
110564
|
|
|
110544
110565
|
unique_ptr<CreateInfo> info;
|
|
110545
110566
|
|
|
110567
|
+
protected:
|
|
110568
|
+
CreateStatement(const CreateStatement &other);
|
|
110569
|
+
|
|
110546
110570
|
public:
|
|
110547
110571
|
unique_ptr<SQLStatement> Copy() const override;
|
|
110548
110572
|
};
|
|
@@ -110793,6 +110817,9 @@ public:
|
|
|
110793
110817
|
unique_ptr<TableRef> table;
|
|
110794
110818
|
vector<unique_ptr<TableRef>> using_clauses;
|
|
110795
110819
|
|
|
110820
|
+
protected:
|
|
110821
|
+
DeleteStatement(const DeleteStatement &other);
|
|
110822
|
+
|
|
110796
110823
|
public:
|
|
110797
110824
|
unique_ptr<SQLStatement> Copy() const override;
|
|
110798
110825
|
};
|
|
@@ -111186,6 +111213,9 @@ public:
|
|
|
111186
111213
|
//! Schema name to insert to
|
|
111187
111214
|
string schema;
|
|
111188
111215
|
|
|
111216
|
+
protected:
|
|
111217
|
+
InsertStatement(const InsertStatement &other);
|
|
111218
|
+
|
|
111189
111219
|
public:
|
|
111190
111220
|
unique_ptr<SQLStatement> Copy() const override;
|
|
111191
111221
|
};
|
|
@@ -112085,6 +112115,9 @@ public:
|
|
|
112085
112115
|
vector<string> columns;
|
|
112086
112116
|
vector<unique_ptr<ParsedExpression>> expressions;
|
|
112087
112117
|
|
|
112118
|
+
protected:
|
|
112119
|
+
UpdateStatement(const UpdateStatement &other);
|
|
112120
|
+
|
|
112088
112121
|
public:
|
|
112089
112122
|
unique_ptr<SQLStatement> Copy() const override;
|
|
112090
112123
|
};
|
|
@@ -112325,6 +112358,9 @@ public:
|
|
|
112325
112358
|
// The SQL statement used instead of a table when copying data out to a file
|
|
112326
112359
|
unique_ptr<QueryNode> select_statement;
|
|
112327
112360
|
|
|
112361
|
+
protected:
|
|
112362
|
+
CopyStatement(const CopyStatement &other);
|
|
112363
|
+
|
|
112328
112364
|
public:
|
|
112329
112365
|
unique_ptr<SQLStatement> Copy() const override;
|
|
112330
112366
|
};
|
|
@@ -135603,6 +135639,8 @@ private:
|
|
|
135603
135639
|
private:
|
|
135604
135640
|
//! Transforms a Postgres statement into a single SQL statement
|
|
135605
135641
|
unique_ptr<SQLStatement> TransformStatement(duckdb_libpgquery::PGNode *stmt);
|
|
135642
|
+
//! Transforms a Postgres statement into a single SQL statement
|
|
135643
|
+
unique_ptr<SQLStatement> TransformStatementInternal(duckdb_libpgquery::PGNode *stmt);
|
|
135606
135644
|
//===--------------------------------------------------------------------===//
|
|
135607
135645
|
// Statement transformation
|
|
135608
135646
|
//===--------------------------------------------------------------------===//
|
|
@@ -136863,10 +136901,12 @@ namespace duckdb {
|
|
|
136863
136901
|
class AlterStatement : public SQLStatement {
|
|
136864
136902
|
public:
|
|
136865
136903
|
AlterStatement();
|
|
136866
|
-
explicit AlterStatement(unique_ptr<AlterInfo> info);
|
|
136867
136904
|
|
|
136868
136905
|
unique_ptr<AlterInfo> info;
|
|
136869
136906
|
|
|
136907
|
+
protected:
|
|
136908
|
+
AlterStatement(const AlterStatement &other);
|
|
136909
|
+
|
|
136870
136910
|
public:
|
|
136871
136911
|
unique_ptr<SQLStatement> Copy() const override;
|
|
136872
136912
|
};
|
|
@@ -136878,13 +136918,12 @@ namespace duckdb {
|
|
|
136878
136918
|
|
|
136879
136919
|
AlterStatement::AlterStatement() : SQLStatement(StatementType::ALTER_STATEMENT) {
|
|
136880
136920
|
}
|
|
136881
|
-
|
|
136882
|
-
|
|
136921
|
+
|
|
136922
|
+
AlterStatement::AlterStatement(const AlterStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
136883
136923
|
}
|
|
136884
136924
|
|
|
136885
136925
|
unique_ptr<SQLStatement> AlterStatement::Copy() const {
|
|
136886
|
-
|
|
136887
|
-
return move(result);
|
|
136926
|
+
return unique_ptr<AlterStatement>(new AlterStatement(*this));
|
|
136888
136927
|
}
|
|
136889
136928
|
|
|
136890
136929
|
} // namespace duckdb
|
|
@@ -136910,6 +136949,9 @@ public:
|
|
|
136910
136949
|
|
|
136911
136950
|
unique_ptr<ParsedExpression> function;
|
|
136912
136951
|
|
|
136952
|
+
protected:
|
|
136953
|
+
CallStatement(const CallStatement &other);
|
|
136954
|
+
|
|
136913
136955
|
public:
|
|
136914
136956
|
unique_ptr<SQLStatement> Copy() const override;
|
|
136915
136957
|
};
|
|
@@ -136921,10 +136963,11 @@ namespace duckdb {
|
|
|
136921
136963
|
CallStatement::CallStatement() : SQLStatement(StatementType::CALL_STATEMENT) {
|
|
136922
136964
|
}
|
|
136923
136965
|
|
|
136966
|
+
CallStatement::CallStatement(const CallStatement &other) : SQLStatement(other), function(other.function->Copy()) {
|
|
136967
|
+
}
|
|
136968
|
+
|
|
136924
136969
|
unique_ptr<SQLStatement> CallStatement::Copy() const {
|
|
136925
|
-
|
|
136926
|
-
result->function = function->Copy();
|
|
136927
|
-
return move(result);
|
|
136970
|
+
return unique_ptr<CallStatement>(new CallStatement(*this));
|
|
136928
136971
|
}
|
|
136929
136972
|
|
|
136930
136973
|
} // namespace duckdb
|
|
@@ -136935,13 +136978,14 @@ namespace duckdb {
|
|
|
136935
136978
|
CopyStatement::CopyStatement() : SQLStatement(StatementType::COPY_STATEMENT), info(make_unique<CopyInfo>()) {
|
|
136936
136979
|
}
|
|
136937
136980
|
|
|
136938
|
-
|
|
136939
|
-
|
|
136940
|
-
|
|
136941
|
-
if (select_statement) {
|
|
136942
|
-
result->select_statement = select_statement->Copy();
|
|
136981
|
+
CopyStatement::CopyStatement(const CopyStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
136982
|
+
if (other.select_statement) {
|
|
136983
|
+
select_statement = other.select_statement->Copy();
|
|
136943
136984
|
}
|
|
136944
|
-
|
|
136985
|
+
}
|
|
136986
|
+
|
|
136987
|
+
unique_ptr<SQLStatement> CopyStatement::Copy() const {
|
|
136988
|
+
return unique_ptr<CopyStatement>(new CopyStatement(*this));
|
|
136945
136989
|
}
|
|
136946
136990
|
|
|
136947
136991
|
} // namespace duckdb
|
|
@@ -136952,10 +136996,11 @@ namespace duckdb {
|
|
|
136952
136996
|
CreateStatement::CreateStatement() : SQLStatement(StatementType::CREATE_STATEMENT) {
|
|
136953
136997
|
}
|
|
136954
136998
|
|
|
136999
|
+
CreateStatement::CreateStatement(const CreateStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
137000
|
+
}
|
|
137001
|
+
|
|
136955
137002
|
unique_ptr<SQLStatement> CreateStatement::Copy() const {
|
|
136956
|
-
|
|
136957
|
-
result->info = info->Copy();
|
|
136958
|
-
return move(result);
|
|
137003
|
+
return unique_ptr<CreateStatement>(new CreateStatement(*this));
|
|
136959
137004
|
}
|
|
136960
137005
|
|
|
136961
137006
|
} // namespace duckdb
|
|
@@ -136966,16 +137011,17 @@ namespace duckdb {
|
|
|
136966
137011
|
DeleteStatement::DeleteStatement() : SQLStatement(StatementType::DELETE_STATEMENT) {
|
|
136967
137012
|
}
|
|
136968
137013
|
|
|
136969
|
-
|
|
136970
|
-
|
|
136971
|
-
|
|
136972
|
-
result->condition = condition->Copy();
|
|
137014
|
+
DeleteStatement::DeleteStatement(const DeleteStatement &other) : SQLStatement(other), table(other.table->Copy()) {
|
|
137015
|
+
if (other.condition) {
|
|
137016
|
+
condition = other.condition->Copy();
|
|
136973
137017
|
}
|
|
136974
|
-
|
|
136975
|
-
|
|
136976
|
-
result->using_clauses.push_back(using_clause->Copy());
|
|
137018
|
+
for (const auto &using_clause : other.using_clauses) {
|
|
137019
|
+
using_clauses.push_back(using_clause->Copy());
|
|
136977
137020
|
}
|
|
136978
|
-
|
|
137021
|
+
}
|
|
137022
|
+
|
|
137023
|
+
unique_ptr<SQLStatement> DeleteStatement::Copy() const {
|
|
137024
|
+
return unique_ptr<DeleteStatement>(new DeleteStatement(*this));
|
|
136979
137025
|
}
|
|
136980
137026
|
|
|
136981
137027
|
} // namespace duckdb
|
|
@@ -136986,10 +137032,11 @@ namespace duckdb {
|
|
|
136986
137032
|
DropStatement::DropStatement() : SQLStatement(StatementType::DROP_STATEMENT), info(make_unique<DropInfo>()) {
|
|
136987
137033
|
}
|
|
136988
137034
|
|
|
137035
|
+
DropStatement::DropStatement(const DropStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
137036
|
+
}
|
|
137037
|
+
|
|
136989
137038
|
unique_ptr<SQLStatement> DropStatement::Copy() const {
|
|
136990
|
-
|
|
136991
|
-
result->info = info->Copy();
|
|
136992
|
-
return move(result);
|
|
137039
|
+
return unique_ptr<DropStatement>(new DropStatement(*this));
|
|
136993
137040
|
}
|
|
136994
137041
|
|
|
136995
137042
|
} // namespace duckdb
|
|
@@ -137000,13 +137047,14 @@ namespace duckdb {
|
|
|
137000
137047
|
ExecuteStatement::ExecuteStatement() : SQLStatement(StatementType::EXECUTE_STATEMENT) {
|
|
137001
137048
|
}
|
|
137002
137049
|
|
|
137003
|
-
|
|
137004
|
-
auto
|
|
137005
|
-
|
|
137006
|
-
for (auto &value : values) {
|
|
137007
|
-
result->values.push_back(value->Copy());
|
|
137050
|
+
ExecuteStatement::ExecuteStatement(const ExecuteStatement &other) : SQLStatement(other), name(other.name) {
|
|
137051
|
+
for (const auto &value : other.values) {
|
|
137052
|
+
values.push_back(value->Copy());
|
|
137008
137053
|
}
|
|
137009
|
-
|
|
137054
|
+
}
|
|
137055
|
+
|
|
137056
|
+
unique_ptr<SQLStatement> ExecuteStatement::Copy() const {
|
|
137057
|
+
return unique_ptr<ExecuteStatement>(new ExecuteStatement(*this));
|
|
137010
137058
|
}
|
|
137011
137059
|
|
|
137012
137060
|
} // namespace duckdb
|
|
@@ -137018,9 +137066,12 @@ ExplainStatement::ExplainStatement(unique_ptr<SQLStatement> stmt, ExplainType ex
|
|
|
137018
137066
|
: SQLStatement(StatementType::EXPLAIN_STATEMENT), stmt(move(stmt)), explain_type(explain_type) {
|
|
137019
137067
|
}
|
|
137020
137068
|
|
|
137069
|
+
ExplainStatement::ExplainStatement(const ExplainStatement &other)
|
|
137070
|
+
: SQLStatement(other), stmt(other.stmt->Copy()), explain_type(other.explain_type) {
|
|
137071
|
+
}
|
|
137072
|
+
|
|
137021
137073
|
unique_ptr<SQLStatement> ExplainStatement::Copy() const {
|
|
137022
|
-
|
|
137023
|
-
return move(result);
|
|
137074
|
+
return unique_ptr<ExplainStatement>(new ExplainStatement(*this));
|
|
137024
137075
|
}
|
|
137025
137076
|
|
|
137026
137077
|
} // namespace duckdb
|
|
@@ -137046,6 +137097,9 @@ public:
|
|
|
137046
137097
|
|
|
137047
137098
|
unique_ptr<CopyInfo> info;
|
|
137048
137099
|
|
|
137100
|
+
protected:
|
|
137101
|
+
ExportStatement(const ExportStatement &other);
|
|
137102
|
+
|
|
137049
137103
|
public:
|
|
137050
137104
|
unique_ptr<SQLStatement> Copy() const override;
|
|
137051
137105
|
};
|
|
@@ -137059,8 +137113,11 @@ ExportStatement::ExportStatement(unique_ptr<CopyInfo> info)
|
|
|
137059
137113
|
: SQLStatement(StatementType::EXPORT_STATEMENT), info(move(info)) {
|
|
137060
137114
|
}
|
|
137061
137115
|
|
|
137116
|
+
ExportStatement::ExportStatement(const ExportStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
137117
|
+
}
|
|
137118
|
+
|
|
137062
137119
|
unique_ptr<SQLStatement> ExportStatement::Copy() const {
|
|
137063
|
-
return
|
|
137120
|
+
return unique_ptr<ExportStatement>(new ExportStatement(*this));
|
|
137064
137121
|
}
|
|
137065
137122
|
|
|
137066
137123
|
} // namespace duckdb
|
|
@@ -137071,20 +137128,21 @@ namespace duckdb {
|
|
|
137071
137128
|
InsertStatement::InsertStatement() : SQLStatement(StatementType::INSERT_STATEMENT), schema(DEFAULT_SCHEMA) {
|
|
137072
137129
|
}
|
|
137073
137130
|
|
|
137131
|
+
InsertStatement::InsertStatement(const InsertStatement &other)
|
|
137132
|
+
: SQLStatement(other),
|
|
137133
|
+
select_statement(unique_ptr_cast<SQLStatement, SelectStatement>(other.select_statement->Copy())),
|
|
137134
|
+
columns(other.columns), table(other.table), schema(other.schema) {
|
|
137135
|
+
}
|
|
137136
|
+
|
|
137074
137137
|
unique_ptr<SQLStatement> InsertStatement::Copy() const {
|
|
137075
|
-
|
|
137076
|
-
result->select_statement = unique_ptr_cast<SQLStatement, SelectStatement>(select_statement->Copy());
|
|
137077
|
-
result->columns = columns;
|
|
137078
|
-
result->table = table;
|
|
137079
|
-
result->schema = schema;
|
|
137080
|
-
return move(result);
|
|
137138
|
+
return unique_ptr<InsertStatement>(new InsertStatement(*this));
|
|
137081
137139
|
}
|
|
137082
137140
|
|
|
137083
137141
|
} // namespace duckdb
|
|
137084
137142
|
//===----------------------------------------------------------------------===//
|
|
137085
137143
|
// DuckDB
|
|
137086
137144
|
//
|
|
137087
|
-
// duckdb/parser/statement/
|
|
137145
|
+
// duckdb/parser/statement/load_statement.hpp
|
|
137088
137146
|
//
|
|
137089
137147
|
//
|
|
137090
137148
|
//===----------------------------------------------------------------------===//
|
|
@@ -137100,6 +137158,9 @@ class LoadStatement : public SQLStatement {
|
|
|
137100
137158
|
public:
|
|
137101
137159
|
LoadStatement();
|
|
137102
137160
|
|
|
137161
|
+
protected:
|
|
137162
|
+
LoadStatement(const LoadStatement &other);
|
|
137163
|
+
|
|
137103
137164
|
public:
|
|
137104
137165
|
unique_ptr<SQLStatement> Copy() const override;
|
|
137105
137166
|
|
|
@@ -137113,10 +137174,11 @@ namespace duckdb {
|
|
|
137113
137174
|
LoadStatement::LoadStatement() : SQLStatement(StatementType::LOAD_STATEMENT) {
|
|
137114
137175
|
}
|
|
137115
137176
|
|
|
137177
|
+
LoadStatement::LoadStatement(const LoadStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
137178
|
+
}
|
|
137179
|
+
|
|
137116
137180
|
unique_ptr<SQLStatement> LoadStatement::Copy() const {
|
|
137117
|
-
|
|
137118
|
-
result->info = info->Copy();
|
|
137119
|
-
return move(result);
|
|
137181
|
+
return unique_ptr<LoadStatement>(new LoadStatement(*this));
|
|
137120
137182
|
}
|
|
137121
137183
|
|
|
137122
137184
|
} // namespace duckdb
|
|
@@ -137127,10 +137189,11 @@ namespace duckdb {
|
|
|
137127
137189
|
PragmaStatement::PragmaStatement() : SQLStatement(StatementType::PRAGMA_STATEMENT), info(make_unique<PragmaInfo>()) {
|
|
137128
137190
|
}
|
|
137129
137191
|
|
|
137192
|
+
PragmaStatement::PragmaStatement(const PragmaStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
137193
|
+
}
|
|
137194
|
+
|
|
137130
137195
|
unique_ptr<SQLStatement> PragmaStatement::Copy() const {
|
|
137131
|
-
|
|
137132
|
-
result->info = info->Copy();
|
|
137133
|
-
return move(result);
|
|
137196
|
+
return unique_ptr<PragmaStatement>(new PragmaStatement(*this));
|
|
137134
137197
|
}
|
|
137135
137198
|
|
|
137136
137199
|
} // namespace duckdb
|
|
@@ -137141,11 +137204,12 @@ namespace duckdb {
|
|
|
137141
137204
|
PrepareStatement::PrepareStatement() : SQLStatement(StatementType::PREPARE_STATEMENT), statement(nullptr), name("") {
|
|
137142
137205
|
}
|
|
137143
137206
|
|
|
137207
|
+
PrepareStatement::PrepareStatement(const PrepareStatement &other)
|
|
137208
|
+
: SQLStatement(other), statement(other.statement->Copy()), name(other.name) {
|
|
137209
|
+
}
|
|
137210
|
+
|
|
137144
137211
|
unique_ptr<SQLStatement> PrepareStatement::Copy() const {
|
|
137145
|
-
|
|
137146
|
-
result->statement = statement->Copy();
|
|
137147
|
-
result->name = name;
|
|
137148
|
-
return move(result);
|
|
137212
|
+
return unique_ptr<PrepareStatement>(new PrepareStatement(*this));
|
|
137149
137213
|
}
|
|
137150
137214
|
|
|
137151
137215
|
} // namespace duckdb
|
|
@@ -137158,8 +137222,7 @@ RelationStatement::RelationStatement(shared_ptr<Relation> relation)
|
|
|
137158
137222
|
}
|
|
137159
137223
|
|
|
137160
137224
|
unique_ptr<SQLStatement> RelationStatement::Copy() const {
|
|
137161
|
-
|
|
137162
|
-
return move(result);
|
|
137225
|
+
return unique_ptr<RelationStatement>(new RelationStatement(*this));
|
|
137163
137226
|
}
|
|
137164
137227
|
|
|
137165
137228
|
} // namespace duckdb
|
|
@@ -137169,10 +137232,11 @@ unique_ptr<SQLStatement> RelationStatement::Copy() const {
|
|
|
137169
137232
|
|
|
137170
137233
|
namespace duckdb {
|
|
137171
137234
|
|
|
137235
|
+
SelectStatement::SelectStatement(const SelectStatement &other) : SQLStatement(other), node(other.node->Copy()) {
|
|
137236
|
+
}
|
|
137237
|
+
|
|
137172
137238
|
unique_ptr<SQLStatement> SelectStatement::Copy() const {
|
|
137173
|
-
|
|
137174
|
-
result->node = node->Copy();
|
|
137175
|
-
return move(result);
|
|
137239
|
+
return unique_ptr<SelectStatement>(new SelectStatement(*this));
|
|
137176
137240
|
}
|
|
137177
137241
|
|
|
137178
137242
|
void SelectStatement::Serialize(Serializer &serializer) const {
|
|
@@ -137214,6 +137278,9 @@ class SetStatement : public SQLStatement {
|
|
|
137214
137278
|
public:
|
|
137215
137279
|
SetStatement(std::string name_p, Value value_p, SetScope scope_p);
|
|
137216
137280
|
|
|
137281
|
+
protected:
|
|
137282
|
+
SetStatement(const SetStatement &other) = default;
|
|
137283
|
+
|
|
137217
137284
|
public:
|
|
137218
137285
|
unique_ptr<SQLStatement> Copy() const override;
|
|
137219
137286
|
|
|
@@ -137231,7 +137298,7 @@ SetStatement::SetStatement(std::string name_p, Value value_p, SetScope scope_p)
|
|
|
137231
137298
|
}
|
|
137232
137299
|
|
|
137233
137300
|
unique_ptr<SQLStatement> SetStatement::Copy() const {
|
|
137234
|
-
return
|
|
137301
|
+
return unique_ptr<SetStatement>(new SetStatement(*this));
|
|
137235
137302
|
}
|
|
137236
137303
|
|
|
137237
137304
|
} // namespace duckdb
|
|
@@ -137256,6 +137323,9 @@ public:
|
|
|
137256
137323
|
|
|
137257
137324
|
unique_ptr<ShowSelectInfo> info;
|
|
137258
137325
|
|
|
137326
|
+
protected:
|
|
137327
|
+
ShowStatement(const ShowStatement &other);
|
|
137328
|
+
|
|
137259
137329
|
public:
|
|
137260
137330
|
unique_ptr<SQLStatement> Copy() const override;
|
|
137261
137331
|
};
|
|
@@ -137268,10 +137338,11 @@ namespace duckdb {
|
|
|
137268
137338
|
ShowStatement::ShowStatement() : SQLStatement(StatementType::SHOW_STATEMENT), info(make_unique<ShowSelectInfo>()) {
|
|
137269
137339
|
}
|
|
137270
137340
|
|
|
137341
|
+
ShowStatement::ShowStatement(const ShowStatement &other) : SQLStatement(other), info(other.info->Copy()) {
|
|
137342
|
+
}
|
|
137343
|
+
|
|
137271
137344
|
unique_ptr<SQLStatement> ShowStatement::Copy() const {
|
|
137272
|
-
|
|
137273
|
-
result->info = info->Copy();
|
|
137274
|
-
return move(result);
|
|
137345
|
+
return unique_ptr<ShowStatement>(new ShowStatement(*this));
|
|
137275
137346
|
}
|
|
137276
137347
|
|
|
137277
137348
|
} // namespace duckdb
|
|
@@ -137296,6 +137367,9 @@ public:
|
|
|
137296
137367
|
|
|
137297
137368
|
unique_ptr<TransactionInfo> info;
|
|
137298
137369
|
|
|
137370
|
+
protected:
|
|
137371
|
+
TransactionStatement(const TransactionStatement &other);
|
|
137372
|
+
|
|
137299
137373
|
public:
|
|
137300
137374
|
unique_ptr<SQLStatement> Copy() const override;
|
|
137301
137375
|
};
|
|
@@ -137308,8 +137382,12 @@ TransactionStatement::TransactionStatement(TransactionType type)
|
|
|
137308
137382
|
: SQLStatement(StatementType::TRANSACTION_STATEMENT), info(make_unique<TransactionInfo>(type)) {
|
|
137309
137383
|
}
|
|
137310
137384
|
|
|
137385
|
+
TransactionStatement::TransactionStatement(const TransactionStatement &other)
|
|
137386
|
+
: SQLStatement(other), info(make_unique<TransactionInfo>(other.info->type)) {
|
|
137387
|
+
}
|
|
137388
|
+
|
|
137311
137389
|
unique_ptr<SQLStatement> TransactionStatement::Copy() const {
|
|
137312
|
-
return
|
|
137390
|
+
return unique_ptr<TransactionStatement>(new TransactionStatement(*this));
|
|
137313
137391
|
}
|
|
137314
137392
|
|
|
137315
137393
|
} // namespace duckdb
|
|
@@ -137320,20 +137398,21 @@ namespace duckdb {
|
|
|
137320
137398
|
UpdateStatement::UpdateStatement() : SQLStatement(StatementType::UPDATE_STATEMENT) {
|
|
137321
137399
|
}
|
|
137322
137400
|
|
|
137323
|
-
|
|
137324
|
-
|
|
137325
|
-
if (condition) {
|
|
137326
|
-
|
|
137401
|
+
UpdateStatement::UpdateStatement(const UpdateStatement &other)
|
|
137402
|
+
: SQLStatement(other), table(other.table->Copy()), columns(other.columns) {
|
|
137403
|
+
if (other.condition) {
|
|
137404
|
+
condition = other.condition->Copy();
|
|
137327
137405
|
}
|
|
137328
|
-
|
|
137329
|
-
|
|
137330
|
-
result->from_table = from_table->Copy();
|
|
137406
|
+
if (other.from_table) {
|
|
137407
|
+
from_table = other.from_table->Copy();
|
|
137331
137408
|
}
|
|
137332
|
-
|
|
137333
|
-
|
|
137334
|
-
result->expressions.push_back(expr->Copy());
|
|
137409
|
+
for (auto &expr : other.expressions) {
|
|
137410
|
+
expressions.emplace_back(expr->Copy());
|
|
137335
137411
|
}
|
|
137336
|
-
|
|
137412
|
+
}
|
|
137413
|
+
|
|
137414
|
+
unique_ptr<SQLStatement> UpdateStatement::Copy() const {
|
|
137415
|
+
return unique_ptr<UpdateStatement>(new UpdateStatement(*this));
|
|
137337
137416
|
}
|
|
137338
137417
|
|
|
137339
137418
|
} // namespace duckdb
|
|
@@ -137359,6 +137438,9 @@ public:
|
|
|
137359
137438
|
|
|
137360
137439
|
unique_ptr<VacuumInfo> info;
|
|
137361
137440
|
|
|
137441
|
+
protected:
|
|
137442
|
+
VacuumStatement(const VacuumStatement &other) : SQLStatement(other) {};
|
|
137443
|
+
|
|
137362
137444
|
public:
|
|
137363
137445
|
unique_ptr<SQLStatement> Copy() const override;
|
|
137364
137446
|
};
|
|
@@ -137372,7 +137454,7 @@ VacuumStatement::VacuumStatement() : SQLStatement(StatementType::VACUUM_STATEMEN
|
|
|
137372
137454
|
}
|
|
137373
137455
|
|
|
137374
137456
|
unique_ptr<SQLStatement> VacuumStatement::Copy() const {
|
|
137375
|
-
return
|
|
137457
|
+
return unique_ptr<VacuumStatement>(new VacuumStatement(*this));
|
|
137376
137458
|
}
|
|
137377
137459
|
|
|
137378
137460
|
} // namespace duckdb
|
|
@@ -141693,7 +141775,10 @@ unique_ptr<AlterStatement> Transformer::TransformRename(duckdb_libpgquery::PGNod
|
|
|
141693
141775
|
throw NotImplementedException("Schema element not supported yet!");
|
|
141694
141776
|
}
|
|
141695
141777
|
D_ASSERT(info);
|
|
141696
|
-
|
|
141778
|
+
|
|
141779
|
+
auto result = make_unique<AlterStatement>();
|
|
141780
|
+
result->info = move(info);
|
|
141781
|
+
return result;
|
|
141697
141782
|
}
|
|
141698
141783
|
|
|
141699
141784
|
} // namespace duckdb
|
|
@@ -142366,6 +142451,12 @@ StackChecker Transformer::StackCheck(idx_t extra_stack) {
|
|
|
142366
142451
|
}
|
|
142367
142452
|
|
|
142368
142453
|
unique_ptr<SQLStatement> Transformer::TransformStatement(duckdb_libpgquery::PGNode *stmt) {
|
|
142454
|
+
auto result = TransformStatementInternal(stmt);
|
|
142455
|
+
result->n_param = ParamCount();
|
|
142456
|
+
return result;
|
|
142457
|
+
}
|
|
142458
|
+
|
|
142459
|
+
unique_ptr<SQLStatement> Transformer::TransformStatementInternal(duckdb_libpgquery::PGNode *stmt) {
|
|
142369
142460
|
switch (stmt->type) {
|
|
142370
142461
|
case duckdb_libpgquery::T_PGRawStmt: {
|
|
142371
142462
|
auto raw_stmt = (duckdb_libpgquery::PGRawStmt *)stmt;
|
|
@@ -148284,7 +148375,9 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
|
148284
148375
|
subquery.column_name_alias =
|
|
148285
148376
|
BindContext::AliasColumnNames(subquery.alias, view_catalog_entry->aliases, ref.column_name_alias);
|
|
148286
148377
|
// bind the child subquery
|
|
148378
|
+
view_binder->AddBoundView(view_catalog_entry);
|
|
148287
148379
|
auto bound_child = view_binder->Bind(subquery);
|
|
148380
|
+
|
|
148288
148381
|
D_ASSERT(bound_child->type == TableReferenceType::SUBQUERY);
|
|
148289
148382
|
// verify that the types and names match up with the expected types and names
|
|
148290
148383
|
auto &bound_subquery = (BoundSubqueryRef &)*bound_child;
|
|
@@ -149273,6 +149366,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundTableFunction &ref) {
|
|
|
149273
149366
|
|
|
149274
149367
|
|
|
149275
149368
|
|
|
149369
|
+
|
|
149276
149370
|
#include <algorithm>
|
|
149277
149371
|
|
|
149278
149372
|
namespace duckdb {
|
|
@@ -149490,6 +149584,19 @@ bool Binder::CTEIsAlreadyBound(CommonTableExpressionInfo *cte) {
|
|
|
149490
149584
|
return false;
|
|
149491
149585
|
}
|
|
149492
149586
|
|
|
149587
|
+
void Binder::AddBoundView(ViewCatalogEntry *view) {
|
|
149588
|
+
// check if the view is already bound
|
|
149589
|
+
auto current = this;
|
|
149590
|
+
while (current) {
|
|
149591
|
+
if (current->bound_views.find(view) != current->bound_views.end()) {
|
|
149592
|
+
throw BinderException("infinite recursion detected: attempting to recursively bind view \"%s\"",
|
|
149593
|
+
view->name);
|
|
149594
|
+
}
|
|
149595
|
+
current = current->parent.get();
|
|
149596
|
+
}
|
|
149597
|
+
bound_views.insert(view);
|
|
149598
|
+
}
|
|
149599
|
+
|
|
149493
149600
|
idx_t Binder::GenerateTableIndex() {
|
|
149494
149601
|
if (parent) {
|
|
149495
149602
|
return parent->GenerateTableIndex();
|
|
@@ -153125,7 +153232,9 @@ void Planner::PlanExecute(unique_ptr<SQLStatement> statement) {
|
|
|
153125
153232
|
vector<Value> bind_values;
|
|
153126
153233
|
for (idx_t i = 0; i < stmt.values.size(); i++) {
|
|
153127
153234
|
ConstantBinder cbinder(*binder, context, "EXECUTE statement");
|
|
153128
|
-
|
|
153235
|
+
if (prepared->value_map.count(i + 1)) {
|
|
153236
|
+
cbinder.target_type = prepared->GetType(i + 1);
|
|
153237
|
+
}
|
|
153129
153238
|
auto bound_expr = cbinder.Bind(stmt.values[i]);
|
|
153130
153239
|
|
|
153131
153240
|
Value value = ExpressionExecutor::EvaluateScalar(*bound_expr);
|