duckdb 0.4.1-dev1328.0 → 0.4.1-dev1344.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.4.1-dev1328.0",
4
+ "version": "0.4.1-dev1344.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -3878,7 +3878,11 @@ unique_ptr<CatalogEntry> TableCatalogEntry::AlterEntry(ClientContext &context, A
3878
3878
  }
3879
3879
  case AlterTableType::FOREIGN_KEY_CONSTRAINT: {
3880
3880
  auto foreign_key_constraint_info = (AlterForeignKeyInfo *)table_info;
3881
- return SetForeignKeyConstraint(context, *foreign_key_constraint_info);
3881
+ if (foreign_key_constraint_info->type == AlterForeignKeyType::AFT_ADD) {
3882
+ return AddForeignKeyConstraint(context, *foreign_key_constraint_info);
3883
+ } else {
3884
+ return DropForeignKeyConstraint(context, *foreign_key_constraint_info);
3885
+ }
3882
3886
  }
3883
3887
  default:
3884
3888
  throw InternalException("Unrecognized alter table type!");
@@ -4216,7 +4220,35 @@ unique_ptr<CatalogEntry> TableCatalogEntry::ChangeColumnType(ClientContext &cont
4216
4220
  return move(result);
4217
4221
  }
4218
4222
 
4219
- unique_ptr<CatalogEntry> TableCatalogEntry::SetForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info) {
4223
+ unique_ptr<CatalogEntry> TableCatalogEntry::AddForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info) {
4224
+ D_ASSERT(info.type == AlterForeignKeyType::AFT_ADD);
4225
+ auto create_info = make_unique<CreateTableInfo>(schema->name, name);
4226
+ create_info->temporary = temporary;
4227
+
4228
+ for (idx_t i = 0; i < columns.size(); i++) {
4229
+ create_info->columns.push_back(columns[i].Copy());
4230
+ }
4231
+ for (idx_t i = 0; i < constraints.size(); i++) {
4232
+ create_info->constraints.push_back(constraints[i]->Copy());
4233
+ }
4234
+ ForeignKeyInfo fk_info;
4235
+ fk_info.type = ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE;
4236
+ fk_info.schema = info.schema;
4237
+ fk_info.table = info.fk_table;
4238
+ fk_info.pk_keys = info.pk_keys;
4239
+ fk_info.fk_keys = info.fk_keys;
4240
+ create_info->constraints.push_back(
4241
+ make_unique<ForeignKeyConstraint>(info.pk_columns, info.fk_columns, move(fk_info)));
4242
+
4243
+ auto binder = Binder::CreateBinder(context);
4244
+ auto bound_create_info = binder->BindCreateTableInfo(move(create_info));
4245
+
4246
+ return make_unique<TableCatalogEntry>(catalog, schema, (BoundCreateTableInfo *)bound_create_info.get(), storage);
4247
+ }
4248
+
4249
+ unique_ptr<CatalogEntry> TableCatalogEntry::DropForeignKeyConstraint(ClientContext &context,
4250
+ AlterForeignKeyInfo &info) {
4251
+ D_ASSERT(info.type == AlterForeignKeyType::AFT_DELETE);
4220
4252
  auto create_info = make_unique<CreateTableInfo>(schema->name, name);
4221
4253
  create_info->temporary = temporary;
4222
4254
 
@@ -4233,16 +4265,6 @@ unique_ptr<CatalogEntry> TableCatalogEntry::SetForeignKeyConstraint(ClientContex
4233
4265
  }
4234
4266
  create_info->constraints.push_back(move(constraint));
4235
4267
  }
4236
- if (info.type == AlterForeignKeyType::AFT_ADD) {
4237
- ForeignKeyInfo fk_info;
4238
- fk_info.type = ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE;
4239
- fk_info.schema = info.schema;
4240
- fk_info.table = info.fk_table;
4241
- fk_info.pk_keys = info.pk_keys;
4242
- fk_info.fk_keys = info.fk_keys;
4243
- create_info->constraints.push_back(
4244
- make_unique<ForeignKeyConstraint>(info.pk_columns, info.fk_columns, move(fk_info)));
4245
- }
4246
4268
 
4247
4269
  auto binder = Binder::CreateBinder(context);
4248
4270
  auto bound_create_info = binder->BindCreateTableInfo(move(create_info));
@@ -176086,7 +176108,7 @@ BindResult ConstantBinder::BindExpression(unique_ptr<ParsedExpression> *expr_ptr
176086
176108
  }
176087
176109
 
176088
176110
  string ConstantBinder::UnsupportedAggregateMessage() {
176089
- return clause + "cannot contain aggregates!";
176111
+ return clause + " cannot contain aggregates!";
176090
176112
  }
176091
176113
 
176092
176114
  } // namespace duckdb
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 "119ee8414"
15
- #define DUCKDB_VERSION "v0.4.1-dev1328"
14
+ #define DUCKDB_SOURCE_ID "457bc43db"
15
+ #define DUCKDB_VERSION "v0.4.1-dev1344"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -12113,7 +12113,8 @@ private:
12113
12113
  unique_ptr<CatalogEntry> RemoveColumn(ClientContext &context, RemoveColumnInfo &info);
12114
12114
  unique_ptr<CatalogEntry> SetDefault(ClientContext &context, SetDefaultInfo &info);
12115
12115
  unique_ptr<CatalogEntry> ChangeColumnType(ClientContext &context, ChangeColumnTypeInfo &info);
12116
- unique_ptr<CatalogEntry> SetForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info);
12116
+ unique_ptr<CatalogEntry> AddForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info);
12117
+ unique_ptr<CatalogEntry> DropForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info);
12117
12118
  };
12118
12119
  } // namespace duckdb
12119
12120
 
@@ -25726,7 +25727,15 @@ public:
25726
25727
  child_list += ")";
25727
25728
  return "(" + in_child + op_type + child_list + ")";
25728
25729
  }
25729
- case ExpressionType::OPERATOR_NOT:
25730
+ case ExpressionType::OPERATOR_NOT: {
25731
+ string result = "(";
25732
+ result += ExpressionTypeToString(entry.type);
25733
+ result += " ";
25734
+ result += StringUtil::Join(entry.children, entry.children.size(), ", ",
25735
+ [](const unique_ptr<BASE> &child) { return child->ToString(); });
25736
+ result += ")";
25737
+ return result;
25738
+ }
25730
25739
  case ExpressionType::GROUPING_FUNCTION:
25731
25740
  case ExpressionType::OPERATOR_COALESCE: {
25732
25741
  string result = ExpressionTypeToString(entry.type);