duckdb 0.3.2-dev1323.0 → 0.3.2-dev1325.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.2-dev1323.0",
4
+ "version": "0.3.2-dev1325.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -148284,7 +148284,9 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
148284
148284
  subquery.column_name_alias =
148285
148285
  BindContext::AliasColumnNames(subquery.alias, view_catalog_entry->aliases, ref.column_name_alias);
148286
148286
  // bind the child subquery
148287
+ view_binder->AddBoundView(view_catalog_entry);
148287
148288
  auto bound_child = view_binder->Bind(subquery);
148289
+
148288
148290
  D_ASSERT(bound_child->type == TableReferenceType::SUBQUERY);
148289
148291
  // verify that the types and names match up with the expected types and names
148290
148292
  auto &bound_subquery = (BoundSubqueryRef &)*bound_child;
@@ -149273,6 +149275,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundTableFunction &ref) {
149273
149275
 
149274
149276
 
149275
149277
 
149278
+
149276
149279
  #include <algorithm>
149277
149280
 
149278
149281
  namespace duckdb {
@@ -149490,6 +149493,19 @@ bool Binder::CTEIsAlreadyBound(CommonTableExpressionInfo *cte) {
149490
149493
  return false;
149491
149494
  }
149492
149495
 
149496
+ void Binder::AddBoundView(ViewCatalogEntry *view) {
149497
+ // check if the view is already bound
149498
+ auto current = this;
149499
+ while (current) {
149500
+ if (current->bound_views.find(view) != current->bound_views.end()) {
149501
+ throw BinderException("infinite recursion detected: attempting to recursively bind view \"%s\"",
149502
+ view->name);
149503
+ }
149504
+ current = current->parent.get();
149505
+ }
149506
+ bound_views.insert(view);
149507
+ }
149508
+
149493
149509
  idx_t Binder::GenerateTableIndex() {
149494
149510
  if (parent) {
149495
149511
  return parent->GenerateTableIndex();
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 "d7a24678d"
15
- #define DUCKDB_VERSION "v0.3.2-dev1323"
14
+ #define DUCKDB_SOURCE_ID "86af59255"
15
+ #define DUCKDB_VERSION "v0.3.2-dev1325"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -15924,6 +15924,9 @@ public:
15924
15924
 
15925
15925
  bool CTEIsAlreadyBound(CommonTableExpressionInfo *cte);
15926
15926
 
15927
+ //! Add the view to the set of currently bound views - used for detecting recursive view definitions
15928
+ void AddBoundView(ViewCatalogEntry *view);
15929
+
15927
15930
  void PushExpressionBinder(ExpressionBinder *binder);
15928
15931
  void PopExpressionBinder();
15929
15932
  void SetActiveBinder(ExpressionBinder *binder);
@@ -15985,6 +15988,8 @@ private:
15985
15988
  BindingMode mode = BindingMode::STANDARD_BINDING;
15986
15989
  //! Table names extracted for BindingMode::EXTRACT_NAMES
15987
15990
  unordered_set<string> table_names;
15991
+ //! The set of bound views
15992
+ unordered_set<ViewCatalogEntry *> bound_views;
15988
15993
 
15989
15994
  private:
15990
15995
  //! Bind the default values of the columns of a table