duckdb 0.5.2-dev50.0 → 0.5.2-dev55.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.2-dev50.0",
4
+ "version": "0.5.2-dev55.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -82798,7 +82798,7 @@ public:
82798
82798
  protected:
82799
82799
  vector<ColumnBinding> GetColumnBindings() override {
82800
82800
  if (return_chunk) {
82801
- return GenerateColumnBindings(table_index, table->columns.size());
82801
+ return GenerateColumnBindings(table_index, table->GetTypes().size());
82802
82802
  }
82803
82803
  return {ColumnBinding(0, 0)};
82804
82804
  }
@@ -84174,7 +84174,7 @@ public:
84174
84174
  protected:
84175
84175
  vector<ColumnBinding> GetColumnBindings() override {
84176
84176
  if (return_chunk) {
84177
- return GenerateColumnBindings(table_index, table->columns.size());
84177
+ return GenerateColumnBindings(table_index, table->GetTypes().size());
84178
84178
  }
84179
84179
  return {ColumnBinding(0, 0)};
84180
84180
  }
@@ -85226,7 +85226,7 @@ public:
85226
85226
  protected:
85227
85227
  vector<ColumnBinding> GetColumnBindings() override {
85228
85228
  if (return_chunk) {
85229
- return GenerateColumnBindings(table_index, table->columns.size());
85229
+ return GenerateColumnBindings(table_index, table->GetTypes().size());
85230
85230
  }
85231
85231
  return {ColumnBinding(0, 0)};
85232
85232
  }
@@ -174848,7 +174848,9 @@ unique_ptr<ParsedExpression> BindContext::ExpandGeneratedColumn(const string &ta
174848
174848
  auto binding = GetBinding(table_name, error_message);
174849
174849
  D_ASSERT(binding);
174850
174850
  auto &table_binding = *(TableBinding *)binding;
174851
- return table_binding.ExpandGeneratedColumn(column_name);
174851
+ auto result = table_binding.ExpandGeneratedColumn(column_name);
174852
+ result->alias = column_name;
174853
+ return result;
174852
174854
  }
174853
174855
 
174854
174856
  unique_ptr<ParsedExpression> BindContext::CreateColumnReference(const string &table_name, const string &column_name) {
@@ -175100,13 +175102,15 @@ void BindContext::AddBinding(const string &alias, unique_ptr<Binding> binding) {
175100
175102
  }
175101
175103
 
175102
175104
  void BindContext::AddBaseTable(idx_t index, const string &alias, const vector<string> &names,
175103
- const vector<LogicalType> &types, LogicalGet &get) {
175104
- AddBinding(alias, make_unique<TableBinding>(alias, types, names, get, index, true));
175105
+ const vector<LogicalType> &types, vector<column_t> &bound_column_ids,
175106
+ StandardEntry *entry) {
175107
+ AddBinding(alias, make_unique<TableBinding>(alias, types, names, bound_column_ids, entry, index, true));
175105
175108
  }
175106
175109
 
175107
175110
  void BindContext::AddTableFunction(idx_t index, const string &alias, const vector<string> &names,
175108
- const vector<LogicalType> &types, LogicalGet &get) {
175109
- AddBinding(alias, make_unique<TableBinding>(alias, types, names, get, index));
175111
+ const vector<LogicalType> &types, vector<column_t> &bound_column_ids,
175112
+ StandardEntry *entry) {
175113
+ AddBinding(alias, make_unique<TableBinding>(alias, types, names, bound_column_ids, entry, index));
175110
175114
  }
175111
175115
 
175112
175116
  static string AddColumnNameToBinding(const string &base_name, case_insensitive_set_t &current_names) {
@@ -176030,7 +176034,12 @@ BindResult ExpressionBinder::BindExpression(ColumnRefExpression &colref_p, idx_t
176030
176034
  }
176031
176035
  //! Generated column returns generated expression
176032
176036
  if (expr->type != ExpressionType::COLUMN_REF) {
176033
- return BindExpression(&expr, depth);
176037
+ auto alias = expr->alias;
176038
+ auto result = BindExpression(&expr, depth);
176039
+ if (result.expression) {
176040
+ result.expression->alias = move(alias);
176041
+ }
176042
+ return result;
176034
176043
  }
176035
176044
  auto &colref = (ColumnRefExpression &)*expr;
176036
176045
  D_ASSERT(colref.IsQualified());
@@ -182036,7 +182045,8 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
182036
182045
 
182037
182046
  auto logical_get = make_unique<LogicalGet>(table_index, scan_function, move(bind_data), move(return_types),
182038
182047
  move(return_names));
182039
- bind_context.AddBaseTable(table_index, alias, table_names, table_types, *logical_get);
182048
+ bind_context.AddBaseTable(table_index, alias, table_names, table_types, logical_get->column_ids,
182049
+ logical_get->GetTable());
182040
182050
  return make_unique_base<BoundTableRef, BoundBaseTableRef>(table, move(logical_get));
182041
182051
  }
182042
182052
  case CatalogType::VIEW_ENTRY: {
@@ -182709,7 +182719,8 @@ Binder::BindTableFunctionInternal(TableFunction &table_function, const string &f
182709
182719
  get->input_table_types = input_table_types;
182710
182720
  get->input_table_names = input_table_names;
182711
182721
  // now add the table function to the bind context so its columns can be bound
182712
- bind_context.AddTableFunction(bind_index, function_name, return_names, return_types, *get);
182722
+ bind_context.AddTableFunction(bind_index, function_name, return_names, return_types, get->column_ids,
182723
+ get->GetTable());
182713
182724
  return move(get);
182714
182725
  }
182715
182726
 
@@ -183550,12 +183561,18 @@ BoundStatement Binder::BindReturning(vector<unique_ptr<ParsedExpression>> return
183550
183561
 
183551
183562
  auto binder = Binder::CreateBinder(context);
183552
183563
 
183564
+ vector<column_t> bound_columns;
183565
+ idx_t column_count = 0;
183553
183566
  for (auto &col : table->columns) {
183554
183567
  names.push_back(col.Name());
183555
183568
  types.push_back(col.Type());
183569
+ if (!col.Generated()) {
183570
+ bound_columns.push_back(column_count);
183571
+ }
183572
+ column_count++;
183556
183573
  }
183557
183574
 
183558
- binder->bind_context.AddGenericBinding(update_table_index, table->name, names, types);
183575
+ binder->bind_context.AddBaseTable(update_table_index, table->name, names, types, bound_columns, table);
183559
183576
  ReturningBinder returning_binder(*binder, context);
183560
183577
 
183561
183578
  vector<unique_ptr<Expression>> projection_expressions;
@@ -189995,7 +190012,6 @@ unique_ptr<Expression> RewriteCountAggregates::VisitReplace(BoundColumnRefExpres
189995
190012
 
189996
190013
 
189997
190014
 
189998
-
189999
190015
  namespace duckdb {
190000
190016
 
190001
190017
  Binding::Binding(BindingType binding_type, const string &alias, vector<LogicalType> coltypes, vector<string> colnames,
@@ -190069,9 +190085,10 @@ StandardEntry *EntryBinding::GetStandardEntry() {
190069
190085
  return &this->entry;
190070
190086
  }
190071
190087
 
190072
- TableBinding::TableBinding(const string &alias, vector<LogicalType> types_p, vector<string> names_p, LogicalGet &get,
190073
- idx_t index, bool add_row_id)
190074
- : Binding(BindingType::TABLE, alias, move(types_p), move(names_p), index), get(get) {
190088
+ TableBinding::TableBinding(const string &alias, vector<LogicalType> types_p, vector<string> names_p,
190089
+ vector<column_t> &bound_column_ids, StandardEntry *entry, idx_t index, bool add_row_id)
190090
+ : Binding(BindingType::TABLE, alias, move(types_p), move(names_p), index), bound_column_ids(bound_column_ids),
190091
+ entry(entry) {
190075
190092
  if (add_row_id) {
190076
190093
  if (name_map.find("rowid") == name_map.end()) {
190077
190094
  name_map["rowid"] = COLUMN_IDENTIFIER_ROW_ID;
@@ -190138,7 +190155,7 @@ BindResult TableBinding::Bind(ColumnRefExpression &colref, idx_t depth) {
190138
190155
  }
190139
190156
  }
190140
190157
 
190141
- auto &column_ids = get.column_ids;
190158
+ auto &column_ids = bound_column_ids;
190142
190159
  // check if the entry already exists in the column list for the table
190143
190160
  ColumnBinding binding;
190144
190161
 
@@ -190158,7 +190175,7 @@ BindResult TableBinding::Bind(ColumnRefExpression &colref, idx_t depth) {
190158
190175
  }
190159
190176
 
190160
190177
  StandardEntry *TableBinding::GetStandardEntry() {
190161
- return get.GetTable();
190178
+ return entry;
190162
190179
  }
190163
190180
 
190164
190181
  string TableBinding::ColumnNotFoundError(const string &column_name) const {