duckdb 0.5.1-dev253.0 → 0.5.1-dev266.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.5.1-dev253.0",
4
+ "version": "0.5.1-dev266.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -3843,6 +3843,9 @@ static void RenameExpression(ParsedExpression &expr, RenameColumnInfo &info) {
3843
3843
 
3844
3844
  unique_ptr<CatalogEntry> TableCatalogEntry::RenameColumn(ClientContext &context, RenameColumnInfo &info) {
3845
3845
  auto rename_idx = GetColumnIndex(info.old_name);
3846
+ if (rename_idx == COLUMN_IDENTIFIER_ROW_ID) {
3847
+ throw CatalogException("Cannot rename rowid column");
3848
+ }
3846
3849
  auto create_info = make_unique<CreateTableInfo>(schema->name, name);
3847
3850
  create_info->temporary = temporary;
3848
3851
  for (idx_t i = 0; i < columns.size(); i++) {
@@ -3945,6 +3948,9 @@ unique_ptr<CatalogEntry> TableCatalogEntry::AddColumn(ClientContext &context, Ad
3945
3948
  unique_ptr<CatalogEntry> TableCatalogEntry::RemoveColumn(ClientContext &context, RemoveColumnInfo &info) {
3946
3949
  auto removed_index = GetColumnIndex(info.removed_column, info.if_column_exists);
3947
3950
  if (removed_index == DConstants::INVALID_INDEX) {
3951
+ if (!info.if_column_exists) {
3952
+ throw CatalogException("Cannot drop column: rowid column cannot be dropped");
3953
+ }
3948
3954
  return nullptr;
3949
3955
  }
3950
3956
 
@@ -4059,6 +4065,9 @@ unique_ptr<CatalogEntry> TableCatalogEntry::RemoveColumn(ClientContext &context,
4059
4065
  unique_ptr<CatalogEntry> TableCatalogEntry::SetDefault(ClientContext &context, SetDefaultInfo &info) {
4060
4066
  auto create_info = make_unique<CreateTableInfo>(schema->name, name);
4061
4067
  auto default_idx = GetColumnIndex(info.column_name);
4068
+ if (default_idx == COLUMN_IDENTIFIER_ROW_ID) {
4069
+ throw CatalogException("Cannot SET DEFAULT for rowid column");
4070
+ }
4062
4071
 
4063
4072
  // Copy all the columns, changing the value of the one that was specified by 'column_name'
4064
4073
  for (idx_t i = 0; i < columns.size(); i++) {
@@ -5057,8 +5066,6 @@ bool CatalogSet::AlterEntry(ClientContext &context, const string &name, AlterInf
5057
5066
  }
5058
5067
  }
5059
5068
  }
5060
- //! Check the dependency manager to verify that there are no conflicting dependencies with this alter
5061
- catalog.dependency_manager->AlterObject(context, entry, value.get());
5062
5069
 
5063
5070
  if (value->name != original_name) {
5064
5071
  // Do PutMapping and DeleteMapping after dependency check
@@ -5076,10 +5083,18 @@ bool CatalogSet::AlterEntry(ClientContext &context, const string &name, AlterInf
5076
5083
  alter_info->Serialize(serializer);
5077
5084
  BinaryData serialized_alter = serializer.GetData();
5078
5085
 
5086
+ auto new_entry = value.get();
5087
+
5079
5088
  // push the old entry in the undo buffer for this transaction
5080
5089
  transaction.PushCatalogEntry(value->child.get(), serialized_alter.data.get(), serialized_alter.size);
5081
5090
  entries[entry_index] = move(value);
5082
5091
 
5092
+ // Check the dependency manager to verify that there are no conflicting dependencies with this alter
5093
+ // Note that we do this AFTER the new entry has been entirely set up in the catalog set
5094
+ // that is because in case the alter fails because of a dependency conflict, we need to be able to cleanly roll back
5095
+ // to the old entry.
5096
+ catalog.dependency_manager->AlterObject(context, entry, new_entry);
5097
+
5083
5098
  return true;
5084
5099
  }
5085
5100
 
@@ -9576,6 +9591,8 @@ void Exception::ThrowAsTypeWithMessage(ExceptionType type, const string &message
9576
9591
  throw ParameterNotAllowedException(message);
9577
9592
  case ExceptionType::PARAMETER_NOT_RESOLVED:
9578
9593
  throw ParameterNotResolvedException();
9594
+ case ExceptionType::FATAL:
9595
+ throw FatalException(message);
9579
9596
  default:
9580
9597
  throw Exception(type, message);
9581
9598
  }
@@ -126569,6 +126586,11 @@ PendingExecutionResult ClientContext::ExecuteTaskInternal(ClientContextLock &loc
126569
126586
  query_progress = active_query->progress_bar->GetCurrentPercentage();
126570
126587
  }
126571
126588
  return result;
126589
+ } catch (FatalException &ex) {
126590
+ // fatal exceptions invalidate the entire database
126591
+ result.SetError(PreservedError(ex));
126592
+ auto &db = DatabaseInstance::GetDatabase(*this);
126593
+ db.Invalidate();
126572
126594
  } catch (const Exception &ex) {
126573
126595
  result.SetError(PreservedError(ex));
126574
126596
  } catch (std::exception &ex) {
@@ -180669,6 +180691,13 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
180669
180691
  info->schema = table->schema->name;
180670
180692
  info->table = table->name;
180671
180693
 
180694
+ // We can not export generated columns
180695
+ for (auto &col : table->columns) {
180696
+ if (!col.Generated()) {
180697
+ info->select_list.push_back(col.GetName());
180698
+ }
180699
+ }
180700
+
180672
180701
  exported_data.table_name = info->table;
180673
180702
  exported_data.schema_name = info->schema;
180674
180703
  exported_data.file_path = info->file_path;
@@ -180914,7 +180943,10 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
180914
180943
  }
180915
180944
 
180916
180945
  // parse select statement and add to logical plan
180917
- auto root_select = Bind(*stmt.select_statement);
180946
+ auto select_binder = Binder::CreateBinder(context, this);
180947
+ auto root_select = select_binder->Bind(*stmt.select_statement);
180948
+ MoveCorrelatedExpressions(*select_binder);
180949
+
180918
180950
  CheckInsertColumnCountMismatch(expected_columns, root_select.types.size(), !stmt.columns.empty(),
180919
180951
  table->name.c_str());
180920
180952
 
@@ -182196,6 +182228,18 @@ string Binder::RetrieveUsingBinding(Binder &current_binder, UsingColumnSet *curr
182196
182228
  return binding;
182197
182229
  }
182198
182230
 
182231
+ static vector<string> RemoveDuplicateUsingColumns(const vector<string> &using_columns) {
182232
+ vector<string> result;
182233
+ case_insensitive_set_t handled_columns;
182234
+ for (auto &using_column : using_columns) {
182235
+ if (handled_columns.find(using_column) == handled_columns.end()) {
182236
+ handled_columns.insert(using_column);
182237
+ result.push_back(using_column);
182238
+ }
182239
+ }
182240
+ return result;
182241
+ }
182242
+
182199
182243
  unique_ptr<BoundTableRef> Binder::Bind(JoinRef &ref) {
182200
182244
  auto result = make_unique<BoundJoinRef>();
182201
182245
  result->left_binder = Binder::CreateBinder(context, this);
@@ -182265,6 +182309,8 @@ unique_ptr<BoundTableRef> Binder::Bind(JoinRef &ref) {
182265
182309
  D_ASSERT(!result->condition);
182266
182310
  extra_using_columns = ref.using_columns;
182267
182311
  }
182312
+ extra_using_columns = RemoveDuplicateUsingColumns(extra_using_columns);
182313
+
182268
182314
  if (!extra_using_columns.empty()) {
182269
182315
  vector<UsingColumnSet *> left_using_bindings;
182270
182316
  vector<UsingColumnSet *> right_using_bindings;
@@ -189652,6 +189698,9 @@ unique_ptr<LogicalOperator> FlattenDependentJoins::PushDownDependentJoinInternal
189652
189698
  case LogicalOperatorType::LOGICAL_ORDER_BY:
189653
189699
  plan->children[0] = PushDownDependentJoin(move(plan->children[0]));
189654
189700
  return plan;
189701
+ case LogicalOperatorType::LOGICAL_RECURSIVE_CTE: {
189702
+ throw ParserException("Recursive CTEs not supported in correlated subquery");
189703
+ }
189655
189704
  default:
189656
189705
  throw InternalException("Logical operator type \"%s\" for dependent join", LogicalOperatorToString(plan->type));
189657
189706
  }
@@ -191778,7 +191827,7 @@ void CheckpointManager::CreateCheckpoint() {
191778
191827
  wal->Flush();
191779
191828
 
191780
191829
  if (config.options.checkpoint_abort == CheckpointAbort::DEBUG_ABORT_BEFORE_HEADER) {
191781
- throw IOException("Checkpoint aborted before header write because of PRAGMA checkpoint_abort flag");
191830
+ throw FatalException("Checkpoint aborted before header write because of PRAGMA checkpoint_abort flag");
191782
191831
  }
191783
191832
 
191784
191833
  // finally write the updated header
@@ -191787,7 +191836,7 @@ void CheckpointManager::CreateCheckpoint() {
191787
191836
  block_manager.WriteHeader(header);
191788
191837
 
191789
191838
  if (config.options.checkpoint_abort == CheckpointAbort::DEBUG_ABORT_BEFORE_TRUNCATE) {
191790
- throw IOException("Checkpoint aborted before truncate because of PRAGMA checkpoint_abort flag");
191839
+ throw FatalException("Checkpoint aborted before truncate because of PRAGMA checkpoint_abort flag");
191791
191840
  }
191792
191841
 
191793
191842
  // truncate the WAL
@@ -199843,7 +199892,7 @@ void SingleFileBlockManager::WriteHeader(DatabaseHeader header) {
199843
199892
 
199844
199893
  auto &config = DBConfig::GetConfig(db);
199845
199894
  if (config.options.checkpoint_abort == CheckpointAbort::DEBUG_ABORT_AFTER_FREE_LIST_WRITE) {
199846
- throw IOException("Checkpoint aborted after free list write because of PRAGMA checkpoint_abort flag");
199895
+ throw FatalException("Checkpoint aborted after free list write because of PRAGMA checkpoint_abort flag");
199847
199896
  }
199848
199897
 
199849
199898
  if (!use_direct_io) {
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "4c95f0c97"
15
- #define DUCKDB_VERSION "v0.5.1-dev253"
14
+ #define DUCKDB_SOURCE_ID "592f08ed0"
15
+ #define DUCKDB_VERSION "v0.5.1-dev266"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //