duckdb 0.3.5-dev362.0 → 0.3.5-dev365.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.5-dev362.0",
4
+ "version": "0.3.5-dev365.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -113027,6 +113027,7 @@ bool ClientContext::TryGetCurrentSetting(const std::string &key, Value &result)
113027
113027
  ParserOptions ClientContext::GetParserOptions() {
113028
113028
  ParserOptions options;
113029
113029
  options.preserve_identifier_case = ClientConfig::GetConfig(*this).preserve_identifier_case;
113030
+ options.max_expression_depth = ClientConfig::GetConfig(*this).max_expression_depth;
113030
113031
  return options;
113031
113032
  }
113032
113033
 
@@ -113246,6 +113247,16 @@ struct LogQueryPathSetting {
113246
113247
  static Value GetSetting(ClientContext &context);
113247
113248
  };
113248
113249
 
113250
+ struct MaximumExpressionDepthSetting {
113251
+ static constexpr const char *Name = "max_expression_depth";
113252
+ static constexpr const char *Description =
113253
+ "The maximum expression depth limit in the parser. WARNING: increasing this setting and using very deep "
113254
+ "expressions might lead to stack overflow errors.";
113255
+ static constexpr const LogicalTypeId InputType = LogicalTypeId::UBIGINT;
113256
+ static void SetLocal(ClientContext &context, const Value &parameter);
113257
+ static Value GetSetting(ClientContext &context);
113258
+ };
113259
+
113249
113260
  struct MaximumMemorySetting {
113250
113261
  static constexpr const char *Name = "max_memory";
113251
113262
  static constexpr const char *Description = "The maximum memory of the system (e.g. 1GB)";
@@ -113379,6 +113390,7 @@ static ConfigurationOption internal_options[] = {DUCKDB_GLOBAL(AccessModeSetting
113379
113390
  DUCKDB_GLOBAL(ExternalThreadsSetting),
113380
113391
  DUCKDB_GLOBAL(ForceCompressionSetting),
113381
113392
  DUCKDB_LOCAL(LogQueryPathSetting),
113393
+ DUCKDB_LOCAL(MaximumExpressionDepthSetting),
113382
113394
  DUCKDB_GLOBAL(MaximumMemorySetting),
113383
113395
  DUCKDB_GLOBAL_ALIAS("memory_limit", MaximumMemorySetting),
113384
113396
  DUCKDB_GLOBAL_ALIAS("null_order", DefaultNullOrderSetting),
@@ -126949,6 +126961,17 @@ Value LogQueryPathSetting::GetSetting(ClientContext &context) {
126949
126961
  return client_data.log_query_writer ? Value(client_data.log_query_writer->path) : Value();
126950
126962
  }
126951
126963
 
126964
+ //===--------------------------------------------------------------------===//
126965
+ // Maximum Expression Depth
126966
+ //===--------------------------------------------------------------------===//
126967
+ void MaximumExpressionDepthSetting::SetLocal(ClientContext &context, const Value &input) {
126968
+ ClientConfig::GetConfig(context).max_expression_depth = input.GetValue<uint64_t>();
126969
+ }
126970
+
126971
+ Value MaximumExpressionDepthSetting::GetSetting(ClientContext &context) {
126972
+ return Value::UBIGINT(ClientConfig::GetConfig(context).max_expression_depth);
126973
+ }
126974
+
126952
126975
  //===--------------------------------------------------------------------===//
126953
126976
  // Maximum Memory
126954
126977
  //===--------------------------------------------------------------------===//
@@ -149577,12 +149600,11 @@ struct GroupingExpressionMap;
149577
149600
  //! The transformer class is responsible for transforming the internal Postgres
149578
149601
  //! parser representation into the DuckDB representation
149579
149602
  class Transformer {
149580
- static constexpr const idx_t DEFAULT_MAX_EXPRESSION_DEPTH = 1000;
149581
-
149582
149603
  friend class StackChecker;
149583
149604
 
149584
149605
  public:
149585
- explicit Transformer(Transformer *parent = nullptr, idx_t max_expression_depth_p = DEFAULT_MAX_EXPRESSION_DEPTH);
149606
+ explicit Transformer(idx_t max_expression_depth_p);
149607
+ explicit Transformer(Transformer *parent);
149586
149608
 
149587
149609
  //! Transforms a Postgres parse tree into a set of SQL Statements
149588
149610
  bool TransformParseTree(duckdb_libpgquery::PGList *tree, vector<unique_ptr<SQLStatement>> &statements);
@@ -149971,7 +149993,7 @@ Parser::Parser(ParserOptions options_p) : options(options_p) {
149971
149993
  }
149972
149994
 
149973
149995
  void Parser::ParseQuery(const string &query) {
149974
- Transformer transformer;
149996
+ Transformer transformer(options.max_expression_depth);
149975
149997
  {
149976
149998
  PostgresParser::SetPreserveIdentifierCase(options.preserve_identifier_case);
149977
149999
  PostgresParser parser;
@@ -156945,9 +156967,12 @@ StackChecker::StackChecker(StackChecker &&other) noexcept
156945
156967
  other.stack_usage = 0;
156946
156968
  }
156947
156969
 
156948
- Transformer::Transformer(Transformer *parent, idx_t max_expression_depth_p)
156949
- : parent(parent), max_expression_depth(parent ? parent->max_expression_depth : max_expression_depth_p),
156950
- stack_depth(DConstants::INVALID_INDEX) {
156970
+ Transformer::Transformer(idx_t max_expression_depth_p)
156971
+ : parent(nullptr), max_expression_depth(max_expression_depth_p), stack_depth(DConstants::INVALID_INDEX) {
156972
+ }
156973
+
156974
+ Transformer::Transformer(Transformer *parent)
156975
+ : parent(parent), max_expression_depth(parent->max_expression_depth), stack_depth(DConstants::INVALID_INDEX) {
156951
156976
  }
156952
156977
 
156953
156978
  bool Transformer::TransformParseTree(duckdb_libpgquery::PGList *tree, vector<unique_ptr<SQLStatement>> &statements) {
@@ -156973,7 +156998,9 @@ StackChecker Transformer::StackCheck(idx_t extra_stack) {
156973
156998
  }
156974
156999
  D_ASSERT(node->stack_depth != DConstants::INVALID_INDEX);
156975
157000
  if (node->stack_depth + extra_stack >= max_expression_depth) {
156976
- throw ParserException("Max expression depth limit of %lld exceeded", max_expression_depth);
157001
+ throw ParserException("Max expression depth limit of %lld exceeded. Use \"SET max_expression_depth TO x\" to "
157002
+ "increase the maximum expression depth.",
157003
+ max_expression_depth);
156977
157004
  }
156978
157005
  return StackChecker(*node, extra_stack);
156979
157006
  }
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 "5f3cc018f"
15
- #define DUCKDB_VERSION "v0.3.5-dev362"
14
+ #define DUCKDB_SOURCE_ID "1366a5f93"
15
+ #define DUCKDB_VERSION "v0.3.5-dev365"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -17200,6 +17200,8 @@ struct ClientConfig {
17200
17200
  //! Preserve identifier case while parsing.
17201
17201
  //! If false, all unquoted identifiers are lower-cased (e.g. "MyTable" -> "mytable").
17202
17202
  bool preserve_identifier_case = true;
17203
+ //! The maximum expression depth limit in the parser
17204
+ idx_t max_expression_depth = 1000;
17203
17205
 
17204
17206
  // Whether or not aggressive query verification is enabled
17205
17207
  bool query_verification_enabled = false;
@@ -21375,6 +21377,7 @@ namespace duckdb {
21375
21377
 
21376
21378
  struct ParserOptions {
21377
21379
  bool preserve_identifier_case = true;
21380
+ idx_t max_expression_depth = 1000;
21378
21381
  };
21379
21382
 
21380
21383
  //! The parser is responsible for parsing the query and converting it into a set