duckdb 0.6.2-dev1114.0 → 0.6.2-dev1120.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
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.6.2-dev1114.0",
5
+ "version": "0.6.2-dev1120.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -1,6 +1,10 @@
1
1
  #include "duckdb/execution/operator/schema/physical_drop.hpp"
2
2
  #include "duckdb/main/client_data.hpp"
3
3
  #include "duckdb/main/database_manager.hpp"
4
+ #include "duckdb/main/database.hpp"
5
+ #include "duckdb/main/client_context.hpp"
6
+ #include "duckdb/catalog/catalog_search_path.hpp"
7
+ #include "duckdb/main/settings.hpp"
4
8
 
5
9
  namespace duckdb {
6
10
 
@@ -39,6 +43,24 @@ void PhysicalDrop::GetData(ExecutionContext &context, DataChunk &chunk, GlobalSo
39
43
  db_manager.DetachDatabase(context.client, info->name, info->if_exists);
40
44
  break;
41
45
  }
46
+ case CatalogType::SCHEMA_ENTRY: {
47
+ auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
48
+ catalog.DropEntry(context.client, info.get());
49
+ auto qualified_name = QualifiedName::Parse(info->name);
50
+
51
+ // Check if the dropped schema was set as the current schema
52
+ auto &client_data = ClientData::Get(context.client);
53
+ auto &default_entry = client_data.catalog_search_path->GetDefault();
54
+ auto &current_catalog = default_entry.catalog;
55
+ auto &current_schema = default_entry.schema;
56
+ D_ASSERT(info->name != DEFAULT_SCHEMA);
57
+
58
+ if (info->catalog == current_catalog && current_schema == info->name) {
59
+ // Reset the schema to default
60
+ SchemaSetting::SetLocal(context.client, DEFAULT_SCHEMA);
61
+ }
62
+ break;
63
+ }
42
64
  default: {
43
65
  auto &catalog = Catalog::GetCatalog(context.client, info->catalog);
44
66
  catalog.DropEntry(context.client, info.get());
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.6.2-dev1114"
2
+ #define DUCKDB_VERSION "0.6.2-dev1120"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "51945c68c0"
5
+ #define DUCKDB_SOURCE_ID "a37177efe6"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -875,7 +875,8 @@ void SchemaSetting::SetLocal(ClientContext &context, const Value &input) {
875
875
  }
876
876
 
877
877
  Value SchemaSetting::GetSetting(ClientContext &context) {
878
- return SearchPathSetting::GetSetting(context);
878
+ auto &client_data = ClientData::Get(context);
879
+ return client_data.catalog_search_path->GetDefault().schema;
879
880
  }
880
881
 
881
882
  //===--------------------------------------------------------------------===//
@@ -44,15 +44,24 @@ unique_ptr<SQLStatement> Transformer::TransformDrop(duckdb_libpgquery::PGNode *n
44
44
  }
45
45
 
46
46
  switch (stmt->removeType) {
47
- case duckdb_libpgquery::PG_OBJECT_SCHEMA:
48
- info.name = ((duckdb_libpgquery::PGValue *)stmt->objects->head->data.ptr_value)->val.str;
49
- break;
50
47
  case duckdb_libpgquery::PG_OBJECT_TYPE: {
51
48
  auto view_list = (duckdb_libpgquery::PGList *)stmt->objects;
52
49
  auto target = (duckdb_libpgquery::PGTypeName *)(view_list->head->data.ptr_value);
53
50
  info.name = (reinterpret_cast<duckdb_libpgquery::PGValue *>(target->names->tail->data.ptr_value)->val.str);
54
51
  break;
55
52
  }
53
+ case duckdb_libpgquery::PG_OBJECT_SCHEMA: {
54
+ auto view_list = (duckdb_libpgquery::PGList *)stmt->objects->head->data.ptr_value;
55
+ if (view_list->length == 2) {
56
+ info.catalog = ((duckdb_libpgquery::PGValue *)view_list->head->data.ptr_value)->val.str;
57
+ info.name = ((duckdb_libpgquery::PGValue *)view_list->head->next->data.ptr_value)->val.str;
58
+ } else if (view_list->length == 1) {
59
+ info.name = ((duckdb_libpgquery::PGValue *)view_list->head->data.ptr_value)->val.str;
60
+ } else {
61
+ throw ParserException("Expected \"catalog.schema\" or \"schema\"");
62
+ }
63
+ break;
64
+ }
56
65
  default: {
57
66
  auto view_list = (duckdb_libpgquery::PGList *)stmt->objects->head->data.ptr_value;
58
67
  if (view_list->length == 3) {
@@ -1065,7 +1065,7 @@ typedef union YYSTYPE
1065
1065
  PGSubLinkType subquerytype;
1066
1066
  PGViewCheckOption viewcheckoption;
1067
1067
  }
1068
- /* Line 1489 of yacc.c. */
1068
+ /* Line 1529 of yacc.c. */
1069
1069
  #line 1070 "third_party/libpg_query/grammar/grammar_out.hpp"
1070
1070
  YYSTYPE;
1071
1071
  # define yystype YYSTYPE /* obsolescent; will be withdrawn */