duckdb 0.5.1-dev255.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-dev255.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) {
@@ -180921,7 +180943,10 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
180921
180943
  }
180922
180944
 
180923
180945
  // parse select statement and add to logical plan
180924
- 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
+
180925
180950
  CheckInsertColumnCountMismatch(expected_columns, root_select.types.size(), !stmt.columns.empty(),
180926
180951
  table->name.c_str());
180927
180952
 
@@ -182203,6 +182228,18 @@ string Binder::RetrieveUsingBinding(Binder &current_binder, UsingColumnSet *curr
182203
182228
  return binding;
182204
182229
  }
182205
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
+
182206
182243
  unique_ptr<BoundTableRef> Binder::Bind(JoinRef &ref) {
182207
182244
  auto result = make_unique<BoundJoinRef>();
182208
182245
  result->left_binder = Binder::CreateBinder(context, this);
@@ -182272,6 +182309,8 @@ unique_ptr<BoundTableRef> Binder::Bind(JoinRef &ref) {
182272
182309
  D_ASSERT(!result->condition);
182273
182310
  extra_using_columns = ref.using_columns;
182274
182311
  }
182312
+ extra_using_columns = RemoveDuplicateUsingColumns(extra_using_columns);
182313
+
182275
182314
  if (!extra_using_columns.empty()) {
182276
182315
  vector<UsingColumnSet *> left_using_bindings;
182277
182316
  vector<UsingColumnSet *> right_using_bindings;
@@ -189659,6 +189698,9 @@ unique_ptr<LogicalOperator> FlattenDependentJoins::PushDownDependentJoinInternal
189659
189698
  case LogicalOperatorType::LOGICAL_ORDER_BY:
189660
189699
  plan->children[0] = PushDownDependentJoin(move(plan->children[0]));
189661
189700
  return plan;
189701
+ case LogicalOperatorType::LOGICAL_RECURSIVE_CTE: {
189702
+ throw ParserException("Recursive CTEs not supported in correlated subquery");
189703
+ }
189662
189704
  default:
189663
189705
  throw InternalException("Logical operator type \"%s\" for dependent join", LogicalOperatorToString(plan->type));
189664
189706
  }
@@ -191785,7 +191827,7 @@ void CheckpointManager::CreateCheckpoint() {
191785
191827
  wal->Flush();
191786
191828
 
191787
191829
  if (config.options.checkpoint_abort == CheckpointAbort::DEBUG_ABORT_BEFORE_HEADER) {
191788
- 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");
191789
191831
  }
191790
191832
 
191791
191833
  // finally write the updated header
@@ -191794,7 +191836,7 @@ void CheckpointManager::CreateCheckpoint() {
191794
191836
  block_manager.WriteHeader(header);
191795
191837
 
191796
191838
  if (config.options.checkpoint_abort == CheckpointAbort::DEBUG_ABORT_BEFORE_TRUNCATE) {
191797
- 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");
191798
191840
  }
191799
191841
 
191800
191842
  // truncate the WAL
@@ -199850,7 +199892,7 @@ void SingleFileBlockManager::WriteHeader(DatabaseHeader header) {
199850
199892
 
199851
199893
  auto &config = DBConfig::GetConfig(db);
199852
199894
  if (config.options.checkpoint_abort == CheckpointAbort::DEBUG_ABORT_AFTER_FREE_LIST_WRITE) {
199853
- 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");
199854
199896
  }
199855
199897
 
199856
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 "726f2ca15"
15
- #define DUCKDB_VERSION "v0.5.1-dev255"
14
+ #define DUCKDB_SOURCE_ID "592f08ed0"
15
+ #define DUCKDB_VERSION "v0.5.1-dev266"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //