duckdb 0.5.2-dev2264.0 → 0.5.2-dev2283.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.5.2-dev2264.0",
5
+ "version": "0.5.2-dev2283.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -186573,7 +186573,7 @@ unique_ptr<ParsedExpression> ExpressionBinder::QualifyColumnName(const string &c
186573
186573
  unique_ptr<Expression> expression;
186574
186574
  if (!using_binding->primary_binding.empty()) {
186575
186575
  // we can! just assign the table name and re-bind
186576
- return make_unique<ColumnRefExpression>(column_name, using_binding->primary_binding);
186576
+ return binder.bind_context.CreateColumnReference(using_binding->primary_binding, column_name);
186577
186577
  } else {
186578
186578
  // // we cannot! we need to bind this as a coalesce between all the relevant columns
186579
186579
  auto coalesce = make_unique<OperatorExpression>(ExpressionType::OPERATOR_COALESCE);
@@ -201228,6 +201228,21 @@ TableBinding::TableBinding(const string &alias, vector<LogicalType> types_p, vec
201228
201228
  }
201229
201229
  }
201230
201230
 
201231
+ static void ReplaceAliases(ParsedExpression &expr, const ColumnList &list,
201232
+ const unordered_map<idx_t, string> &alias_map) {
201233
+ if (expr.type == ExpressionType::COLUMN_REF) {
201234
+ auto &colref = (ColumnRefExpression &)expr;
201235
+ D_ASSERT(!colref.IsQualified());
201236
+ auto &col_names = colref.column_names;
201237
+ D_ASSERT(col_names.size() == 1);
201238
+ auto idx_entry = list.GetColumnIndex(col_names[0]);
201239
+ auto &alias = alias_map.at(idx_entry.index);
201240
+ col_names = {alias};
201241
+ }
201242
+ ParsedExpressionIterator::EnumerateChildren(
201243
+ expr, [&](const ParsedExpression &child) { ReplaceAliases((ParsedExpression &)child, list, alias_map); });
201244
+ }
201245
+
201231
201246
  static void BakeTableName(ParsedExpression &expr, const string &table_name) {
201232
201247
  if (expr.type == ExpressionType::COLUMN_REF) {
201233
201248
  auto &colref = (ColumnRefExpression &)expr;
@@ -201251,6 +201266,11 @@ unique_ptr<ParsedExpression> TableBinding::ExpandGeneratedColumn(const string &c
201251
201266
  D_ASSERT(table_entry->columns.GetColumn(LogicalIndex(column_index)).Generated());
201252
201267
  // Get a copy of the generated column
201253
201268
  auto expression = table_entry->columns.GetColumn(LogicalIndex(column_index)).GeneratedExpression().Copy();
201269
+ unordered_map<idx_t, string> alias_map;
201270
+ for (auto &entry : name_map) {
201271
+ alias_map[entry.second] = entry.first;
201272
+ }
201273
+ ReplaceAliases(*expression, table_entry->columns, alias_map);
201254
201274
  BakeTableName(*expression, alias);
201255
201275
  return (expression);
201256
201276
  }
@@ -201263,18 +201283,16 @@ BindResult TableBinding::Bind(ColumnRefExpression &colref, idx_t depth) {
201263
201283
  if (!success) {
201264
201284
  return BindResult(ColumnNotFoundError(column_name));
201265
201285
  }
201266
- #ifdef DEBUG
201267
201286
  auto entry = GetStandardEntry();
201268
- if (entry) {
201287
+ if (entry && column_index != COLUMN_IDENTIFIER_ROW_ID) {
201269
201288
  D_ASSERT(entry->type == CatalogType::TABLE_ENTRY);
201289
+ // Either there is no table, or the columns category has to be standard
201270
201290
  auto table_entry = (TableCatalogEntry *)entry;
201271
- //! Either there is no table, or the columns category has to be standard
201272
- if (column_index != COLUMN_IDENTIFIER_ROW_ID) {
201273
- D_ASSERT(table_entry->columns.GetColumn(LogicalIndex(column_index)).Category() ==
201274
- TableColumnType::STANDARD);
201275
- }
201291
+ auto &column_entry = table_entry->columns.GetColumn(LogicalIndex(column_index));
201292
+ (void)table_entry;
201293
+ (void)column_entry;
201294
+ D_ASSERT(column_entry.Category() == TableColumnType::STANDARD);
201276
201295
  }
201277
- #endif /* DEBUG */
201278
201296
  // fetch the type of the column
201279
201297
  LogicalType col_type;
201280
201298
  if (column_index == COLUMN_IDENTIFIER_ROW_ID) {
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 "a2a67f76e8"
15
- #define DUCKDB_VERSION "v0.5.2-dev2264"
14
+ #define DUCKDB_SOURCE_ID "f0ec7187be"
15
+ #define DUCKDB_VERSION "v0.5.2-dev2283"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //