duckdb 0.3.5-dev368.0 → 0.3.5-dev372.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.5-dev368.0",
4
+ "version": "0.3.5-dev372.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -6923,17 +6923,6 @@ string StatementTypeToString(StatementType type) {
6923
6923
  }
6924
6924
  // LCOV_EXCL_STOP
6925
6925
 
6926
- bool StatementTypeReturnChanges(StatementType type) {
6927
- switch (type) {
6928
- case StatementType::INSERT_STATEMENT:
6929
- case StatementType::UPDATE_STATEMENT:
6930
- case StatementType::DELETE_STATEMENT:
6931
- return true;
6932
- default:
6933
- return false;
6934
- }
6935
- }
6936
-
6937
6926
  } // namespace duckdb
6938
6927
 
6939
6928
 
@@ -60088,15 +60077,8 @@ public:
60088
60077
  //! The result types of the transaction
60089
60078
  vector<LogicalType> types;
60090
60079
 
60091
- //! Whether or not the statement is a read-only statement, or whether it can result in changes to the database
60092
- bool read_only;
60093
- //! Whether or not the statement requires a valid transaction. Almost all statements require this, with the
60094
- //! exception of
60095
- bool requires_valid_transaction;
60096
- //! Whether or not the result can be streamed to the client
60097
- bool allow_stream_result;
60098
- //! Whether or not all parameters have successfully had their types determined
60099
- bool bound_all_parameters;
60080
+ //! The statement properties
60081
+ StatementProperties properties;
60100
60082
 
60101
60083
  //! The catalog version of when the prepared statement was bound
60102
60084
  //! If this version is lower than the current catalog version, we have to rebind the prepared statement
@@ -109137,7 +109119,7 @@ idx_t duckdb_arrow_rows_changed(duckdb_arrow result) {
109137
109119
  auto wrapper = (ArrowResultWrapper *)result;
109138
109120
  idx_t rows_changed = 0;
109139
109121
  idx_t row_count = wrapper->result->collection.Count();
109140
- if (row_count > 0 && StatementTypeReturnChanges(wrapper->result->statement_type)) {
109122
+ if (row_count > 0 && wrapper->result->properties.return_type == duckdb::StatementReturnType::CHANGED_ROWS) {
109141
109123
  auto row_changes = wrapper->result->GetValue(0, 0);
109142
109124
  if (!row_changes.IsNull() && row_changes.TryCastAs(LogicalType::BIGINT)) {
109143
109125
  rows_changed = row_changes.GetValue<int64_t>();
@@ -110595,7 +110577,8 @@ bool deprecated_materialize_result(duckdb_result *result) {
110595
110577
  result->__deprecated_columns[i].__deprecated_name = (char *)result_data->result->names[i].c_str();
110596
110578
  }
110597
110579
  result->__deprecated_row_count = materialized.collection.Count();
110598
- if (result->__deprecated_row_count > 0 && StatementTypeReturnChanges(materialized.statement_type)) {
110580
+ if (result->__deprecated_row_count > 0 &&
110581
+ materialized.properties.return_type == StatementReturnType::CHANGED_ROWS) {
110599
110582
  // update total changes
110600
110583
  auto row_changes = materialized.GetValue(0, 0);
110601
110584
  if (!row_changes.IsNull() && row_changes.TryCastAs(LogicalType::BIGINT)) {
@@ -111809,10 +111792,7 @@ public:
111809
111792
  shared_ptr<Binder> binder;
111810
111793
  ClientContext &context;
111811
111794
 
111812
- bool read_only;
111813
- bool requires_valid_transaction;
111814
- bool allow_stream_result;
111815
- bool bound_all_parameters;
111795
+ StatementProperties properties;
111816
111796
 
111817
111797
  private:
111818
111798
  void CreatePlan(SQLStatement &statement);
@@ -112101,20 +112081,22 @@ unique_ptr<QueryResult> ClientContext::FetchResultInternal(ClientContextLock &lo
112101
112081
  D_ASSERT(active_query->open_result == &pending);
112102
112082
  D_ASSERT(active_query->prepared);
112103
112083
  auto &prepared = *active_query->prepared;
112104
- bool create_stream_result = prepared.allow_stream_result && allow_stream_result;
112084
+ bool create_stream_result = prepared.properties.allow_stream_result && allow_stream_result;
112105
112085
  if (create_stream_result) {
112106
112086
  active_query->progress_bar.reset();
112107
112087
  query_progress = -1;
112108
112088
 
112109
112089
  // successfully compiled SELECT clause and it is the last statement
112110
112090
  // return a StreamQueryResult so the client can call Fetch() on it and stream the result
112111
- auto stream_result =
112112
- make_unique<StreamQueryResult>(pending.statement_type, shared_from_this(), pending.types, pending.names);
112091
+ auto stream_result = make_unique<StreamQueryResult>(pending.statement_type, pending.properties,
112092
+ shared_from_this(), pending.types, pending.names);
112113
112093
  active_query->open_result = stream_result.get();
112114
112094
  return move(stream_result);
112115
112095
  }
112116
112096
  // create a materialized result by continuously fetching
112117
- auto result = make_unique<MaterializedQueryResult>(pending.statement_type, pending.types, pending.names);
112097
+ auto result =
112098
+ make_unique<MaterializedQueryResult>(pending.statement_type, pending.properties, pending.types, pending.names);
112099
+ result->properties = pending.properties;
112118
112100
  while (true) {
112119
112101
  auto chunk = FetchInternal(lock, GetExecutor(), *result);
112120
112102
  if (!chunk || chunk->size() == 0) {
@@ -112155,14 +112137,11 @@ shared_ptr<PreparedStatementData> ClientContext::CreatePreparedStatement(ClientC
112155
112137
  plan->Verify();
112156
112138
  #endif
112157
112139
  // extract the result column names from the plan
112158
- result->read_only = planner.read_only;
112159
- result->requires_valid_transaction = planner.requires_valid_transaction;
112160
- result->allow_stream_result = planner.allow_stream_result;
112140
+ result->properties = planner.properties;
112161
112141
  result->names = planner.names;
112162
112142
  result->types = planner.types;
112163
112143
  result->value_map = move(planner.value_map);
112164
112144
  result->catalog_version = Transaction::GetTransaction(*this).catalog_version;
112165
- result->bound_all_parameters = planner.bound_all_parameters;
112166
112145
 
112167
112146
  if (config.enable_optimizer) {
112168
112147
  profiler.StartPhase("optimizer");
@@ -112198,11 +112177,11 @@ unique_ptr<PendingQueryResult> ClientContext::PendingPreparedStatement(ClientCon
112198
112177
  vector<Value> bound_values) {
112199
112178
  D_ASSERT(active_query);
112200
112179
  auto &statement = *statement_p;
112201
- if (ActiveTransaction().IsInvalidated() && statement.requires_valid_transaction) {
112180
+ if (ActiveTransaction().IsInvalidated() && statement.properties.requires_valid_transaction) {
112202
112181
  throw Exception("Current transaction is aborted (please ROLLBACK)");
112203
112182
  }
112204
112183
  auto &db_config = DBConfig::GetConfig(*this);
112205
- if (db_config.access_mode == AccessMode::READ_ONLY && !statement.read_only) {
112184
+ if (db_config.access_mode == AccessMode::READ_ONLY && !statement.properties.read_only) {
112206
112185
  throw Exception(StringUtil::Format("Cannot execute statement of type \"%s\" in read-only mode!",
112207
112186
  StatementTypeToString(statement.statement_type)));
112208
112187
  }
@@ -112471,17 +112450,17 @@ ClientContext::PendingStatementOrPreparedStatement(ClientContextLock &lock, cons
112471
112450
  result = PendingStatementInternal(lock, query, move(statement));
112472
112451
  } else {
112473
112452
  auto &catalog = Catalog::GetCatalog(*this);
112474
- if (prepared->unbound_statement &&
112475
- (catalog.GetCatalogVersion() != prepared->catalog_version || !prepared->bound_all_parameters)) {
112453
+ if (prepared->unbound_statement && (catalog.GetCatalogVersion() != prepared->catalog_version ||
112454
+ !prepared->properties.bound_all_parameters)) {
112476
112455
  // catalog was modified: rebind the statement before execution
112477
112456
  auto new_prepared = CreatePreparedStatement(lock, query, prepared->unbound_statement->Copy(), values);
112478
- if (prepared->types != new_prepared->types && prepared->bound_all_parameters) {
112457
+ if (prepared->types != new_prepared->types && prepared->properties.bound_all_parameters) {
112479
112458
  throw BinderException("Rebinding statement after catalog change resulted in change of types");
112480
112459
  }
112481
- D_ASSERT(new_prepared->bound_all_parameters);
112460
+ D_ASSERT(new_prepared->properties.bound_all_parameters);
112482
112461
  new_prepared->unbound_statement = move(prepared->unbound_statement);
112483
112462
  prepared = move(new_prepared);
112484
- prepared->bound_all_parameters = false;
112463
+ prepared->properties.bound_all_parameters = false;
112485
112464
  }
112486
112465
  result = PendingPreparedStatement(lock, prepared, *values);
112487
112466
  }
@@ -112539,7 +112518,11 @@ unique_ptr<QueryResult> ClientContext::Query(const string &query, bool allow_str
112539
112518
  }
112540
112519
  if (statements.empty()) {
112541
112520
  // no statements, return empty successful result
112542
- return make_unique<MaterializedQueryResult>(StatementType::INVALID_STATEMENT);
112521
+ StatementProperties properties;
112522
+ vector<LogicalType> types;
112523
+ vector<string> names;
112524
+ return make_unique<MaterializedQueryResult>(StatementType::INVALID_STATEMENT, properties, move(types),
112525
+ move(names));
112543
112526
  }
112544
112527
 
112545
112528
  unique_ptr<QueryResult> result;
@@ -122905,13 +122888,9 @@ Extension::~Extension() {
122905
122888
 
122906
122889
  namespace duckdb {
122907
122890
 
122908
- MaterializedQueryResult::MaterializedQueryResult(StatementType statement_type)
122909
- : QueryResult(QueryResultType::MATERIALIZED_RESULT, statement_type) {
122910
- }
122911
-
122912
- MaterializedQueryResult::MaterializedQueryResult(StatementType statement_type, vector<LogicalType> types,
122913
- vector<string> names)
122914
- : QueryResult(QueryResultType::MATERIALIZED_RESULT, statement_type, move(types), move(names)) {
122891
+ MaterializedQueryResult::MaterializedQueryResult(StatementType statement_type, StatementProperties properties,
122892
+ vector<LogicalType> types, vector<string> names)
122893
+ : QueryResult(QueryResultType::MATERIALIZED_RESULT, statement_type, properties, move(types), move(names)) {
122915
122894
  }
122916
122895
 
122917
122896
  MaterializedQueryResult::MaterializedQueryResult(string error)
@@ -122964,7 +122943,8 @@ namespace duckdb {
122964
122943
 
122965
122944
  PendingQueryResult::PendingQueryResult(shared_ptr<ClientContext> context_p, PreparedStatementData &statement,
122966
122945
  vector<LogicalType> types_p)
122967
- : BaseQueryResult(QueryResultType::PENDING_RESULT, statement.statement_type, move(types_p), statement.names),
122946
+ : BaseQueryResult(QueryResultType::PENDING_RESULT, statement.statement_type, statement.properties, move(types_p),
122947
+ statement.names),
122968
122948
  context(move(context_p)) {
122969
122949
  }
122970
122950
 
@@ -123054,6 +123034,11 @@ StatementType PreparedStatement::GetStatementType() {
123054
123034
  return data->statement_type;
123055
123035
  }
123056
123036
 
123037
+ StatementProperties PreparedStatement::GetStatementProperties() {
123038
+ D_ASSERT(data);
123039
+ return data->properties;
123040
+ }
123041
+
123057
123042
  const vector<LogicalType> &PreparedStatement::GetTypes() {
123058
123043
  D_ASSERT(data);
123059
123044
  return data->types;
@@ -123069,7 +123054,7 @@ unique_ptr<QueryResult> PreparedStatement::Execute(vector<Value> &values, bool a
123069
123054
  if (!pending->success) {
123070
123055
  return make_unique<MaterializedQueryResult>(pending->error);
123071
123056
  }
123072
- return pending->Execute(allow_stream_result && data->allow_stream_result);
123057
+ return pending->Execute(allow_stream_result && data->properties.allow_stream_result);
123073
123058
  }
123074
123059
 
123075
123060
  unique_ptr<PendingQueryResult> PreparedStatement::PendingQuery(vector<Value> &values) {
@@ -123088,9 +123073,7 @@ unique_ptr<PendingQueryResult> PreparedStatement::PendingQuery(vector<Value> &va
123088
123073
 
123089
123074
  namespace duckdb {
123090
123075
 
123091
- PreparedStatementData::PreparedStatementData(StatementType type)
123092
- : statement_type(type), read_only(true), requires_valid_transaction(true), allow_stream_result(false),
123093
- bound_all_parameters(true) {
123076
+ PreparedStatementData::PreparedStatementData(StatementType type) : statement_type(type) {
123094
123077
  }
123095
123078
 
123096
123079
  PreparedStatementData::~PreparedStatementData() {
@@ -123835,13 +123818,10 @@ ExpressionRootInfo::ExpressionRootInfo(ExpressionExecutorState &state, string na
123835
123818
 
123836
123819
  namespace duckdb {
123837
123820
 
123838
- BaseQueryResult::BaseQueryResult(QueryResultType type, StatementType statement_type)
123839
- : type(type), statement_type(statement_type), success(true) {
123840
- }
123841
-
123842
- BaseQueryResult::BaseQueryResult(QueryResultType type, StatementType statement_type, vector<LogicalType> types_p,
123843
- vector<string> names_p)
123844
- : type(type), statement_type(statement_type), types(move(types_p)), names(move(names_p)), success(true) {
123821
+ BaseQueryResult::BaseQueryResult(QueryResultType type, StatementType statement_type, StatementProperties properties,
123822
+ vector<LogicalType> types_p, vector<string> names_p)
123823
+ : type(type), statement_type(statement_type), properties(properties), types(move(types_p)), names(move(names_p)),
123824
+ success(true) {
123845
123825
  D_ASSERT(types.size() == names.size());
123846
123826
  }
123847
123827
 
@@ -123861,12 +123841,9 @@ idx_t BaseQueryResult::ColumnCount() {
123861
123841
  return types.size();
123862
123842
  }
123863
123843
 
123864
- QueryResult::QueryResult(QueryResultType type, StatementType statement_type) : BaseQueryResult(type, statement_type) {
123865
- }
123866
-
123867
- QueryResult::QueryResult(QueryResultType type, StatementType statement_type, vector<LogicalType> types_p,
123868
- vector<string> names_p)
123869
- : BaseQueryResult(type, statement_type, move(types_p), move(names_p)) {
123844
+ QueryResult::QueryResult(QueryResultType type, StatementType statement_type, StatementProperties properties,
123845
+ vector<LogicalType> types_p, vector<string> names_p)
123846
+ : BaseQueryResult(type, statement_type, properties, move(types_p), move(names_p)) {
123870
123847
  }
123871
123848
 
123872
123849
  QueryResult::QueryResult(QueryResultType type, string error) : BaseQueryResult(type, move(error)) {
@@ -127147,9 +127124,10 @@ Value ThreadsSetting::GetSetting(ClientContext &context) {
127147
127124
 
127148
127125
  namespace duckdb {
127149
127126
 
127150
- StreamQueryResult::StreamQueryResult(StatementType statement_type, shared_ptr<ClientContext> context,
127151
- vector<LogicalType> types, vector<string> names)
127152
- : QueryResult(QueryResultType::STREAM_RESULT, statement_type, move(types), move(names)), context(move(context)) {
127127
+ StreamQueryResult::StreamQueryResult(StatementType statement_type, StatementProperties properties,
127128
+ shared_ptr<ClientContext> context, vector<LogicalType> types, vector<string> names)
127129
+ : QueryResult(QueryResultType::STREAM_RESULT, statement_type, properties, move(types), move(names)),
127130
+ context(move(context)) {
127153
127131
  }
127154
127132
 
127155
127133
  StreamQueryResult::~StreamQueryResult() {
@@ -127199,7 +127177,7 @@ unique_ptr<MaterializedQueryResult> StreamQueryResult::Materialize() {
127199
127177
  if (!success) {
127200
127178
  return make_unique<MaterializedQueryResult>(error);
127201
127179
  }
127202
- auto result = make_unique<MaterializedQueryResult>(statement_type, types, names);
127180
+ auto result = make_unique<MaterializedQueryResult>(statement_type, properties, types, names);
127203
127181
  while (true) {
127204
127182
  auto chunk = Fetch();
127205
127183
  if (!chunk || chunk->size() == 0) {
@@ -161132,6 +161110,7 @@ BoundStatement Binder::Bind(CallStatement &stmt) {
161132
161110
  result.types = get.returned_types;
161133
161111
  result.names = get.names;
161134
161112
  result.plan = CreatePlan(*bound_func);
161113
+ properties.return_type = StatementReturnType::QUERY_RESULT;
161135
161114
  return result;
161136
161115
  }
161137
161116
 
@@ -161278,7 +161257,8 @@ BoundStatement Binder::Bind(CopyStatement &stmt) {
161278
161257
  }
161279
161258
  stmt.select_statement = move(statement);
161280
161259
  }
161281
- this->allow_stream_result = false;
161260
+ properties.allow_stream_result = false;
161261
+ properties.return_type = StatementReturnType::CHANGED_ROWS;
161282
161262
  if (stmt.info->is_from) {
161283
161263
  return BindCopyFrom(stmt);
161284
161264
  } else {
@@ -161417,7 +161397,7 @@ SchemaCatalogEntry *Binder::BindSchema(CreateInfo &info) {
161417
161397
  if (info.schema == TEMP_SCHEMA) {
161418
161398
  throw ParserException("Only TEMPORARY table names can use the \"temp\" schema");
161419
161399
  }
161420
- this->read_only = false;
161400
+ properties.read_only = false;
161421
161401
  } else {
161422
161402
  if (info.schema != TEMP_SCHEMA) {
161423
161403
  throw ParserException("TEMPORARY table names can *only* use the \"%s\" schema", TEMP_SCHEMA);
@@ -161562,6 +161542,7 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
161562
161542
  BoundStatement result;
161563
161543
  result.names = {"Count"};
161564
161544
  result.types = {LogicalType::BIGINT};
161545
+ properties.return_type = StatementReturnType::NOTHING;
161565
161546
 
161566
161547
  auto catalog_type = stmt.info->type;
161567
161548
  switch (catalog_type) {
@@ -161672,6 +161653,8 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
161672
161653
  auto &schema = bound_info->schema;
161673
161654
  auto create_table = make_unique<LogicalCreateTable>(schema, move(bound_info));
161674
161655
  if (root) {
161656
+ // CREATE TABLE AS
161657
+ properties.return_type = StatementReturnType::CHANGED_ROWS;
161675
161658
  create_table->children.push_back(move(root));
161676
161659
  }
161677
161660
  result.plan = move(create_table);
@@ -161685,7 +161668,7 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
161685
161668
  default:
161686
161669
  throw Exception("Unrecognized type!");
161687
161670
  }
161688
- this->allow_stream_result = false;
161671
+ properties.allow_stream_result = false;
161689
161672
  return result;
161690
161673
  }
161691
161674
 
@@ -161939,7 +161922,7 @@ unique_ptr<BoundCreateTableInfo> Binder::BindCreateTableInfo(unique_ptr<CreateIn
161939
161922
  }
161940
161923
  }
161941
161924
  }
161942
- this->allow_stream_result = false;
161925
+ properties.allow_stream_result = false;
161943
161926
  return result;
161944
161927
  }
161945
161928
 
@@ -161999,7 +161982,7 @@ BoundStatement Binder::Bind(DeleteStatement &stmt) {
161999
161982
 
162000
161983
  if (!table->temporary) {
162001
161984
  // delete from persistent table: not read only!
162002
- this->read_only = false;
161985
+ properties.read_only = false;
162003
161986
  }
162004
161987
 
162005
161988
  // plan any tables from the various using clauses
@@ -162060,7 +162043,8 @@ BoundStatement Binder::Bind(DeleteStatement &stmt) {
162060
162043
  result.plan = move(del);
162061
162044
  result.names = {"Count"};
162062
162045
  result.types = {LogicalType::BIGINT};
162063
- this->allow_stream_result = false;
162046
+ properties.allow_stream_result = false;
162047
+ properties.return_type = StatementReturnType::CHANGED_ROWS;
162064
162048
  }
162065
162049
  return result;
162066
162050
  }
@@ -162082,11 +162066,11 @@ BoundStatement Binder::Bind(DropStatement &stmt) {
162082
162066
  case CatalogType::PREPARED_STATEMENT:
162083
162067
  // dropping prepared statements is always possible
162084
162068
  // it also does not require a valid transaction
162085
- this->requires_valid_transaction = false;
162069
+ properties.requires_valid_transaction = false;
162086
162070
  break;
162087
162071
  case CatalogType::SCHEMA_ENTRY:
162088
162072
  // dropping a schema is never read-only because there are no temporary schemas
162089
- this->read_only = false;
162073
+ properties.read_only = false;
162090
162074
  break;
162091
162075
  case CatalogType::VIEW_ENTRY:
162092
162076
  case CatalogType::SEQUENCE_ENTRY:
@@ -162102,7 +162086,7 @@ BoundStatement Binder::Bind(DropStatement &stmt) {
162102
162086
  }
162103
162087
  if (!entry->temporary) {
162104
162088
  // we can only drop temporary tables in read-only mode
162105
- this->read_only = false;
162089
+ properties.read_only = false;
162106
162090
  }
162107
162091
  stmt.info->schema = entry->schema->name;
162108
162092
  break;
@@ -162113,7 +162097,8 @@ BoundStatement Binder::Bind(DropStatement &stmt) {
162113
162097
  result.plan = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_DROP, move(stmt.info));
162114
162098
  result.names = {"Success"};
162115
162099
  result.types = {LogicalType::BOOLEAN};
162116
- this->allow_stream_result = false;
162100
+ properties.allow_stream_result = false;
162101
+ properties.return_type = StatementReturnType::NOTHING;
162117
162102
  return result;
162118
162103
  }
162119
162104
 
@@ -162137,6 +162122,7 @@ BoundStatement Binder::Bind(ExplainStatement &stmt) {
162137
162122
  result.plan = move(explain);
162138
162123
  result.names = {"explain_key", "explain_value"};
162139
162124
  result.types = {LogicalType::VARCHAR, LogicalType::VARCHAR};
162125
+ properties.return_type = StatementReturnType::QUERY_RESULT;
162140
162126
  return result;
162141
162127
  }
162142
162128
 
@@ -162340,7 +162326,8 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
162340
162326
  }
162341
162327
 
162342
162328
  result.plan = move(export_node);
162343
- this->allow_stream_result = false;
162329
+ properties.allow_stream_result = false;
162330
+ properties.return_type = StatementReturnType::NOTHING;
162344
162331
  return result;
162345
162332
  }
162346
162333
 
@@ -162408,7 +162395,7 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
162408
162395
  D_ASSERT(table);
162409
162396
  if (!table->temporary) {
162410
162397
  // inserting into a non-temporary table: alters underlying database
162411
- this->read_only = false;
162398
+ properties.read_only = false;
162412
162399
  }
162413
162400
 
162414
162401
  auto insert = make_unique<LogicalInsert>(table);
@@ -162514,7 +162501,8 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
162514
162501
  } else {
162515
162502
  D_ASSERT(result.types.size() == result.names.size());
162516
162503
  result.plan = move(insert);
162517
- this->allow_stream_result = false;
162504
+ properties.allow_stream_result = false;
162505
+ properties.return_type = StatementReturnType::CHANGED_ROWS;
162518
162506
  return result;
162519
162507
  }
162520
162508
  }
@@ -162533,7 +162521,8 @@ BoundStatement Binder::Bind(LoadStatement &stmt) {
162533
162521
  result.names = {"Success"};
162534
162522
 
162535
162523
  result.plan = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_LOAD, move(stmt.info));
162536
- this->allow_stream_result = false;
162524
+ properties.allow_stream_result = false;
162525
+ properties.return_type = StatementReturnType::NOTHING;
162537
162526
  return result;
162538
162527
  }
162539
162528
 
@@ -162569,6 +162558,7 @@ BoundStatement Binder::Bind(PragmaStatement &stmt) {
162569
162558
  result.names = {"Success"};
162570
162559
  result.types = {LogicalType::BOOLEAN};
162571
162560
  result.plan = make_unique<LogicalPragma>(bound_function, *stmt.info);
162561
+ properties.return_type = StatementReturnType::QUERY_RESULT;
162572
162562
  return result;
162573
162563
  }
162574
162564
 
@@ -162594,7 +162584,8 @@ BoundStatement Binder::Bind(RelationStatement &stmt) {
162594
162584
  namespace duckdb {
162595
162585
 
162596
162586
  BoundStatement Binder::Bind(SelectStatement &stmt) {
162597
- this->allow_stream_result = true;
162587
+ properties.allow_stream_result = true;
162588
+ properties.return_type = StatementReturnType::QUERY_RESULT;
162598
162589
  return Bind(*stmt.node);
162599
162590
  }
162600
162591
 
@@ -162612,6 +162603,7 @@ BoundStatement Binder::Bind(SetStatement &stmt) {
162612
162603
  result.names = {"Success"};
162613
162604
 
162614
162605
  result.plan = make_unique<LogicalSet>(stmt.name, stmt.value, stmt.scope);
162606
+ properties.return_type = StatementReturnType::NOTHING;
162615
162607
  return result;
162616
162608
  }
162617
162609
 
@@ -162641,6 +162633,7 @@ BoundStatement Binder::Bind(ShowStatement &stmt) {
162641
162633
  result.names = {"column_name", "column_type", "null", "key", "default", "extra"};
162642
162634
  result.types = {LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR,
162643
162635
  LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR};
162636
+ properties.return_type = StatementReturnType::QUERY_RESULT;
162644
162637
  return result;
162645
162638
  }
162646
162639
 
@@ -162666,20 +162659,22 @@ BoundStatement Binder::Bind(AlterStatement &stmt) {
162666
162659
  auto entry = catalog.GetEntry(context, stmt.info->GetCatalogType(), stmt.info->schema, stmt.info->name, true);
162667
162660
  if (entry && !entry->temporary) {
162668
162661
  // we can only alter temporary tables/views in read-only mode
162669
- this->read_only = false;
162662
+ properties.read_only = false;
162670
162663
  }
162671
162664
  result.plan = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_ALTER, move(stmt.info));
162665
+ properties.return_type = StatementReturnType::NOTHING;
162672
162666
  return result;
162673
162667
  }
162674
162668
 
162675
162669
  BoundStatement Binder::Bind(TransactionStatement &stmt) {
162676
162670
  // transaction statements do not require a valid transaction
162677
- this->requires_valid_transaction = false;
162671
+ properties.requires_valid_transaction = false;
162678
162672
 
162679
162673
  BoundStatement result;
162680
162674
  result.names = {"Success"};
162681
162675
  result.types = {LogicalType::BOOLEAN};
162682
162676
  result.plan = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_TRANSACTION, move(stmt.info));
162677
+ properties.return_type = StatementReturnType::NOTHING;
162683
162678
  return result;
162684
162679
  }
162685
162680
 
@@ -162814,6 +162809,7 @@ BoundStatement Binder::BindSummarize(ShowStatement &stmt) {
162814
162809
  select_node->select_list.push_back(SummarizeWrapUnnest(null_percentage_children, "null_percentage"));
162815
162810
  select_node->from_table = move(subquery_ref);
162816
162811
 
162812
+ properties.return_type = StatementReturnType::QUERY_RESULT;
162817
162813
  return Bind(*select_node);
162818
162814
  }
162819
162815
 
@@ -163022,7 +163018,7 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) {
163022
163018
 
163023
163019
  if (!table->temporary) {
163024
163020
  // update of persistent table: not read only!
163025
- this->read_only = false;
163021
+ properties.read_only = false;
163026
163022
  }
163027
163023
  auto update = make_unique<LogicalUpdate>(table);
163028
163024
 
@@ -163103,7 +163099,8 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) {
163103
163099
  result.names = {"Count"};
163104
163100
  result.types = {LogicalType::BIGINT};
163105
163101
  result.plan = move(update);
163106
- this->allow_stream_result = false;
163102
+ properties.allow_stream_result = false;
163103
+ properties.return_type = StatementReturnType::CHANGED_ROWS;
163107
163104
  }
163108
163105
  return result;
163109
163106
  }
@@ -163120,6 +163117,7 @@ BoundStatement Binder::Bind(VacuumStatement &stmt) {
163120
163117
  result.names = {"Success"};
163121
163118
  result.types = {LogicalType::BOOLEAN};
163122
163119
  result.plan = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_VACUUM, move(stmt.info));
163120
+ properties.return_type = StatementReturnType::NOTHING;
163123
163121
  return result;
163124
163122
  }
163125
163123
 
@@ -164413,8 +164411,7 @@ shared_ptr<Binder> Binder::CreateBinder(ClientContext &context, Binder *parent,
164413
164411
  }
164414
164412
 
164415
164413
  Binder::Binder(bool, ClientContext &context, shared_ptr<Binder> parent_p, bool inherit_ctes_p)
164416
- : context(context), read_only(true), requires_valid_transaction(true), allow_stream_result(false),
164417
- parent(move(parent_p)), bound_tables(0), inherit_ctes(inherit_ctes_p) {
164414
+ : context(context), parent(move(parent_p)), bound_tables(0), inherit_ctes(inherit_ctes_p) {
164418
164415
  parameters = nullptr;
164419
164416
  parameter_types = nullptr;
164420
164417
  if (parent) {
@@ -164815,7 +164812,8 @@ BoundStatement Binder::BindReturning(vector<unique_ptr<ParsedExpression>> return
164815
164812
  projection->AddChild(move(child_operator));
164816
164813
  D_ASSERT(result.types.size() == result.names.size());
164817
164814
  result.plan = move(projection);
164818
- this->allow_stream_result = true;
164815
+ properties.allow_stream_result = true;
164816
+ properties.return_type = StatementReturnType::QUERY_RESULT;
164819
164817
  return result;
164820
164818
  }
164821
164819
 
@@ -168234,19 +168232,17 @@ void Planner::CreatePlan(SQLStatement &statement) {
168234
168232
  auto bound_statement = binder->Bind(statement);
168235
168233
  profiler.EndPhase();
168236
168234
 
168237
- this->read_only = binder->read_only;
168238
- this->requires_valid_transaction = binder->requires_valid_transaction;
168239
- this->allow_stream_result = binder->allow_stream_result;
168235
+ this->properties = binder->properties;
168240
168236
  this->names = bound_statement.names;
168241
168237
  this->types = bound_statement.types;
168242
168238
  this->plan = move(bound_statement.plan);
168243
- this->bound_all_parameters = true;
168239
+ properties.bound_all_parameters = true;
168244
168240
 
168245
168241
  // set up a map of parameter number -> value entries
168246
168242
  for (auto &expr : bound_parameters) {
168247
168243
  // check if the type of the parameter could be resolved
168248
168244
  if (expr->return_type.id() == LogicalTypeId::INVALID || expr->return_type.id() == LogicalTypeId::UNKNOWN) {
168249
- this->bound_all_parameters = false;
168245
+ properties.bound_all_parameters = false;
168250
168246
  continue;
168251
168247
  }
168252
168248
  auto value = make_unique<Value>(expr->return_type);
@@ -168274,11 +168270,8 @@ shared_ptr<PreparedStatementData> Planner::PrepareSQLStatement(unique_ptr<SQLSta
168274
168270
  prepared_data->names = names;
168275
168271
  prepared_data->types = types;
168276
168272
  prepared_data->value_map = move(value_map);
168277
- prepared_data->read_only = this->read_only;
168278
- prepared_data->requires_valid_transaction = this->requires_valid_transaction;
168279
- prepared_data->allow_stream_result = this->allow_stream_result;
168273
+ prepared_data->properties = properties;
168280
168274
  prepared_data->catalog_version = Transaction::GetTransaction(context).catalog_version;
168281
- prepared_data->bound_all_parameters = this->bound_all_parameters;
168282
168275
  return prepared_data;
168283
168276
  }
168284
168277
 
@@ -168308,7 +168301,7 @@ void Planner::PlanExecute(unique_ptr<SQLStatement> statement) {
168308
168301
  Value value = ExpressionExecutor::EvaluateScalar(*bound_expr);
168309
168302
  bind_values.push_back(move(value));
168310
168303
  }
168311
- bool all_bound = prepared->bound_all_parameters;
168304
+ bool all_bound = prepared->properties.bound_all_parameters;
168312
168305
  if (catalog.GetCatalogVersion() != entry->second->catalog_version || !all_bound) {
168313
168306
  // catalog was modified or statement does not have clear types: rebind the statement before running the execute
168314
168307
  for (auto &value : bind_values) {
@@ -168319,7 +168312,7 @@ void Planner::PlanExecute(unique_ptr<SQLStatement> statement) {
168319
168312
  throw BinderException("Rebinding statement \"%s\" after catalog change resulted in change of types",
168320
168313
  stmt.name);
168321
168314
  }
168322
- D_ASSERT(prepared->bound_all_parameters);
168315
+ D_ASSERT(prepared->properties.bound_all_parameters);
168323
168316
  rebound = true;
168324
168317
  }
168325
168318
  // add casts to the prepared statement parameters as required
@@ -168339,12 +168332,9 @@ void Planner::PlanExecute(unique_ptr<SQLStatement> statement) {
168339
168332
  }
168340
168333
 
168341
168334
  // copy the properties of the prepared statement into the planner
168342
- this->read_only = prepared->read_only;
168343
- this->requires_valid_transaction = prepared->requires_valid_transaction;
168344
- this->allow_stream_result = prepared->allow_stream_result;
168335
+ this->properties = prepared->properties;
168345
168336
  this->names = prepared->names;
168346
168337
  this->types = prepared->types;
168347
- this->bound_all_parameters = prepared->bound_all_parameters;
168348
168338
  this->plan = make_unique<LogicalExecute>(move(prepared));
168349
168339
  }
168350
168340
 
@@ -168354,12 +168344,13 @@ void Planner::PlanPrepare(unique_ptr<SQLStatement> statement) {
168354
168344
 
168355
168345
  auto prepare = make_unique<LogicalPrepare>(stmt.name, move(prepared_data), move(plan));
168356
168346
  // we can prepare in read-only mode: prepared statements are not written to the catalog
168357
- this->read_only = true;
168347
+ properties.read_only = true;
168358
168348
  // we can always prepare, even if the transaction has been invalidated
168359
168349
  // this is required because most clients ALWAYS invoke prepared statements
168360
- this->requires_valid_transaction = false;
168361
- this->allow_stream_result = false;
168362
- this->bound_all_parameters = true;
168350
+ properties.requires_valid_transaction = false;
168351
+ properties.allow_stream_result = false;
168352
+ properties.bound_all_parameters = true;
168353
+ properties.return_type = StatementReturnType::NOTHING;
168363
168354
  this->names = {"Success"};
168364
168355
  this->types = {LogicalType::BOOLEAN};
168365
168356
  this->plan = move(prepare);