duckdb 0.3.2-dev502.0 → 0.3.2-dev528.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-dev502.0",
4
+ "version": "0.3.2-dev528.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -11770,6 +11770,8 @@ string Exception::ExceptionTypeToString(ExceptionType type) {
11770
11770
  return "Invalid Input";
11771
11771
  case ExceptionType::OUT_OF_MEMORY:
11772
11772
  return "Out of Memory";
11773
+ case ExceptionType::PERMISSION:
11774
+ return "Permission";
11773
11775
  default:
11774
11776
  return "Unknown";
11775
11777
  }
@@ -11855,6 +11857,9 @@ CatalogException::CatalogException(const string &msg) : StandardException(Except
11855
11857
  ParserException::ParserException(const string &msg) : StandardException(ExceptionType::PARSER, msg) {
11856
11858
  }
11857
11859
 
11860
+ PermissionException::PermissionException(const string &msg) : StandardException(ExceptionType::PERMISSION, msg) {
11861
+ }
11862
+
11858
11863
  SyntaxException::SyntaxException(const string &msg) : Exception(ExceptionType::SYNTAX, msg) {
11859
11864
  }
11860
11865
 
@@ -27293,11 +27298,9 @@ struct RowOperations {
27293
27298
  //! Swizzles the base pointer of each row to offset within heap block
27294
27299
  static void SwizzleHeapPointer(const RowLayout &layout, data_ptr_t row_ptr, const data_ptr_t heap_base_ptr,
27295
27300
  const idx_t count);
27296
- //! Swizzles the base offset of each row back to a pointer
27297
- static void UnswizzleHeapPointer(const RowLayout &layout, data_ptr_t row_ptr, const data_ptr_t heap_base_ptr,
27298
- const idx_t count);
27299
- //! Unswizzles offsets back to pointers to blobs
27300
- static void UnswizzleColumns(const RowLayout &layout, const data_ptr_t base_row_ptr, const idx_t count);
27301
+ //! Unswizzles all offsets back to pointers
27302
+ static void UnswizzlePointers(const RowLayout &layout, const data_ptr_t base_row_ptr,
27303
+ const data_ptr_t base_heap_ptr, const idx_t count);
27301
27304
  };
27302
27305
 
27303
27306
  } // namespace duckdb
@@ -27533,46 +27536,44 @@ namespace duckdb {
27533
27536
 
27534
27537
  void RowOperations::SwizzleColumns(const RowLayout &layout, const data_ptr_t base_row_ptr, const idx_t count) {
27535
27538
  const idx_t row_width = layout.GetRowWidth();
27536
- const idx_t heap_pointer_offset = layout.GetHeapPointerOffset();
27537
- // Swizzle the blob columns one by one
27538
- for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) {
27539
- auto physical_type = layout.GetTypes()[col_idx].InternalType();
27540
- if (TypeIsConstantSize(physical_type)) {
27541
- continue;
27539
+ data_ptr_t heap_row_ptrs[STANDARD_VECTOR_SIZE];
27540
+ idx_t done = 0;
27541
+ while (done != count) {
27542
+ const idx_t next = MinValue<idx_t>(count - done, STANDARD_VECTOR_SIZE);
27543
+ const data_ptr_t row_ptr = base_row_ptr + done * row_width;
27544
+ // Load heap row pointers
27545
+ data_ptr_t heap_ptr_ptr = row_ptr + layout.GetHeapPointerOffset();
27546
+ for (idx_t i = 0; i < next; i++) {
27547
+ heap_row_ptrs[i] = Load<data_ptr_t>(heap_ptr_ptr);
27548
+ heap_ptr_ptr += row_width;
27542
27549
  }
27543
- data_ptr_t row_ptr = base_row_ptr;
27544
- const idx_t &col_offset = layout.GetOffsets()[col_idx];
27545
- if (physical_type == PhysicalType::VARCHAR) {
27546
- // Replace the pointer with the computed offset (if non-inlined)
27547
- const idx_t string_pointer_offset = sizeof(uint32_t) + string_t::PREFIX_LENGTH;
27548
- for (idx_t i = 0; i < count; i++) {
27549
- const string_t str = Load<string_t>(row_ptr + col_offset);
27550
- if (!str.IsInlined()) {
27551
- // Load the pointer to the start of the row in the heap
27552
- data_ptr_t heap_row_ptr = Load<data_ptr_t>(row_ptr + heap_pointer_offset);
27553
- // This is where the pointer that points to the heap is stored in the RowLayout
27554
- data_ptr_t col_ptr = row_ptr + col_offset + string_pointer_offset;
27555
- // Load the pointer to the data of this column in the same heap row
27556
- data_ptr_t heap_col_ptr = Load<data_ptr_t>(col_ptr);
27557
- // Overwrite the column data pointer with the within-row offset (pointer arithmetic)
27558
- Store<idx_t>(heap_col_ptr - heap_row_ptr, col_ptr);
27559
- }
27560
- row_ptr += row_width;
27550
+ // Loop through the blob columns
27551
+ for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) {
27552
+ auto physical_type = layout.GetTypes()[col_idx].InternalType();
27553
+ if (TypeIsConstantSize(physical_type)) {
27554
+ continue;
27561
27555
  }
27562
- } else {
27563
- // Replace the pointer with the computed offset
27564
- for (idx_t i = 0; i < count; i++) {
27565
- // Load the pointer to the start of the row in the heap
27566
- data_ptr_t heap_row_ptr = Load<data_ptr_t>(row_ptr + heap_pointer_offset);
27567
- // This is where the pointer that points to the heap is stored in the RowLayout
27568
- data_ptr_t col_ptr = row_ptr + col_offset;
27569
- // Load the pointer to the data of this column in the same heap row
27570
- data_ptr_t heap_col_ptr = Load<data_ptr_t>(col_ptr);
27571
- // Overwrite the column data pointer with the within-row offset (pointer arithmetic)
27572
- Store<idx_t>(heap_col_ptr - heap_row_ptr, col_ptr);
27573
- row_ptr += row_width;
27556
+ data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx];
27557
+ if (physical_type == PhysicalType::VARCHAR) {
27558
+ data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH;
27559
+ for (idx_t i = 0; i < next; i++) {
27560
+ if (Load<uint32_t>(col_ptr) > string_t::INLINE_LENGTH) {
27561
+ // Overwrite the string pointer with the within-row offset (if not inlined)
27562
+ Store<idx_t>(Load<data_ptr_t>(string_ptr) - heap_row_ptrs[i], string_ptr);
27563
+ }
27564
+ col_ptr += row_width;
27565
+ string_ptr += row_width;
27566
+ }
27567
+ } else {
27568
+ // Non-varchar blob columns
27569
+ for (idx_t i = 0; i < next; i++) {
27570
+ // Overwrite the column data pointer with the within-row offset
27571
+ Store<idx_t>(Load<data_ptr_t>(col_ptr) - heap_row_ptrs[i], col_ptr);
27572
+ col_ptr += row_width;
27573
+ }
27574
27574
  }
27575
27575
  }
27576
+ done += next;
27576
27577
  }
27577
27578
  }
27578
27579
 
@@ -27588,59 +27589,48 @@ void RowOperations::SwizzleHeapPointer(const RowLayout &layout, data_ptr_t row_p
27588
27589
  }
27589
27590
  }
27590
27591
 
27591
- void RowOperations::UnswizzleHeapPointer(const RowLayout &layout, data_ptr_t row_ptr, const data_ptr_t heap_base_ptr,
27592
- const idx_t count) {
27592
+ void RowOperations::UnswizzlePointers(const RowLayout &layout, const data_ptr_t base_row_ptr,
27593
+ const data_ptr_t base_heap_ptr, const idx_t count) {
27593
27594
  const idx_t row_width = layout.GetRowWidth();
27594
- row_ptr += layout.GetHeapPointerOffset();
27595
- for (idx_t i = 0; i < count; i++) {
27596
- idx_t heap_row_offset = Load<idx_t>(row_ptr);
27597
- Store<data_ptr_t>(heap_base_ptr + heap_row_offset, row_ptr);
27598
- row_ptr += row_width;
27599
- }
27600
- }
27601
-
27602
- void RowOperations::UnswizzleColumns(const RowLayout &layout, const data_ptr_t base_row_ptr, const idx_t count) {
27603
- const idx_t row_width = layout.GetRowWidth();
27604
- const idx_t heap_pointer_offset = layout.GetHeapPointerOffset();
27605
- // Unswizzle the columns one by one
27606
- for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) {
27607
- auto physical_type = layout.GetTypes()[col_idx].InternalType();
27608
- if (TypeIsConstantSize(physical_type)) {
27609
- continue;
27610
- }
27611
- const idx_t col_offset = layout.GetOffsets()[col_idx];
27612
- data_ptr_t row_ptr = base_row_ptr;
27613
- if (physical_type == PhysicalType::VARCHAR) {
27614
- // Replace offset with the pointer (if non-inlined)
27615
- const idx_t string_pointer_offset = sizeof(uint32_t) + string_t::PREFIX_LENGTH;
27616
- for (idx_t i = 0; i < count; i++) {
27617
- const string_t str = Load<string_t>(row_ptr + col_offset);
27618
- if (!str.IsInlined()) {
27619
- // Load the pointer to the start of the row in the heap
27620
- data_ptr_t heap_row_ptr = Load<data_ptr_t>(row_ptr + heap_pointer_offset);
27621
- // This is where the pointer that points to the heap is stored in the RowLayout
27622
- data_ptr_t col_ptr = row_ptr + col_offset + string_pointer_offset;
27623
- // Load the offset to the data of this column in the same heap row
27624
- idx_t heap_col_offset = Load<idx_t>(col_ptr);
27595
+ data_ptr_t heap_row_ptrs[STANDARD_VECTOR_SIZE];
27596
+ idx_t done = 0;
27597
+ while (done != count) {
27598
+ const idx_t next = MinValue<idx_t>(count - done, STANDARD_VECTOR_SIZE);
27599
+ const data_ptr_t row_ptr = base_row_ptr + done * row_width;
27600
+ // Restore heap row pointers
27601
+ data_ptr_t heap_ptr_ptr = row_ptr + layout.GetHeapPointerOffset();
27602
+ for (idx_t i = 0; i < next; i++) {
27603
+ heap_row_ptrs[i] = base_heap_ptr + Load<idx_t>(heap_ptr_ptr);
27604
+ Store<data_ptr_t>(heap_row_ptrs[i], heap_ptr_ptr);
27605
+ heap_ptr_ptr += row_width;
27606
+ }
27607
+ // Loop through the blob columns
27608
+ for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) {
27609
+ auto physical_type = layout.GetTypes()[col_idx].InternalType();
27610
+ if (TypeIsConstantSize(physical_type)) {
27611
+ continue;
27612
+ }
27613
+ data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx];
27614
+ if (physical_type == PhysicalType::VARCHAR) {
27615
+ data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH;
27616
+ for (idx_t i = 0; i < next; i++) {
27617
+ if (Load<uint32_t>(col_ptr) > string_t::INLINE_LENGTH) {
27618
+ // Overwrite the string offset with the pointer (if not inlined)
27619
+ Store<data_ptr_t>(heap_row_ptrs[i] + Load<idx_t>(string_ptr), string_ptr);
27620
+ }
27621
+ col_ptr += row_width;
27622
+ string_ptr += row_width;
27623
+ }
27624
+ } else {
27625
+ // Non-varchar blob columns
27626
+ for (idx_t i = 0; i < next; i++) {
27625
27627
  // Overwrite the column data offset with the pointer
27626
- Store<data_ptr_t>(heap_row_ptr + heap_col_offset, col_ptr);
27628
+ Store<data_ptr_t>(heap_row_ptrs[i] + Load<idx_t>(col_ptr), col_ptr);
27629
+ col_ptr += row_width;
27627
27630
  }
27628
- row_ptr += row_width;
27629
- }
27630
- } else {
27631
- // Replace the offset with the pointer
27632
- for (idx_t i = 0; i < count; i++) {
27633
- // Load the pointer to the start of the row in the heap
27634
- data_ptr_t heap_row_ptr = Load<data_ptr_t>(row_ptr + heap_pointer_offset);
27635
- // This is where the pointer that points to the heap is stored in the RowLayout
27636
- data_ptr_t col_ptr = row_ptr + col_offset;
27637
- // Load the offset to the data of this column in the same heap row
27638
- idx_t heap_col_offset = Load<idx_t>(col_ptr);
27639
- // Overwrite the column data offset with the pointer
27640
- Store<data_ptr_t>(heap_row_ptr + heap_col_offset, col_ptr);
27641
- row_ptr += row_width;
27642
27631
  }
27643
27632
  }
27633
+ done += next;
27644
27634
  }
27645
27635
  }
27646
27636
 
@@ -32711,8 +32701,7 @@ void SortedData::Unswizzle() {
32711
32701
  auto &heap_block = heap_blocks[i];
32712
32702
  auto data_handle_p = buffer_manager.Pin(data_block.block);
32713
32703
  auto heap_handle_p = buffer_manager.Pin(heap_block.block);
32714
- RowOperations::UnswizzleHeapPointer(layout, data_handle_p->Ptr(), heap_handle_p->Ptr(), data_block.count);
32715
- RowOperations::UnswizzleColumns(layout, data_handle_p->Ptr(), data_block.count);
32704
+ RowOperations::UnswizzlePointers(layout, data_handle_p->Ptr(), heap_handle_p->Ptr(), data_block.count);
32716
32705
  state.heap_blocks.push_back(move(heap_block));
32717
32706
  state.pinned_blocks.push_back(move(heap_handle_p));
32718
32707
  }
@@ -32958,9 +32947,7 @@ void PayloadScanner::Scan(DataChunk &chunk) {
32958
32947
  }
32959
32948
  // Unswizzle the offsets back to pointers (if needed)
32960
32949
  if (!sorted_data.layout.AllConstant() && global_sort_state.external) {
32961
- RowOperations::UnswizzleHeapPointer(sorted_data.layout, data_ptr, read_state.payload_heap_handle->Ptr(),
32962
- next);
32963
- RowOperations::UnswizzleColumns(sorted_data.layout, data_ptr, next);
32950
+ RowOperations::UnswizzlePointers(sorted_data.layout, data_ptr, read_state.payload_heap_handle->Ptr(), next);
32964
32951
  }
32965
32952
  // Update state indices
32966
32953
  read_state.entry_idx += next;
@@ -38105,7 +38092,7 @@ bool TryAddOperator::Operation(int16_t left, int16_t right, int16_t &result);
38105
38092
  template <>
38106
38093
  bool TryAddOperator::Operation(int32_t left, int32_t right, int32_t &result);
38107
38094
  template <>
38108
- bool TryAddOperator::Operation(int64_t left, int64_t right, int64_t &result);
38095
+ DUCKDB_API bool TryAddOperator::Operation(int64_t left, int64_t right, int64_t &result);
38109
38096
 
38110
38097
  struct AddOperatorOverflowCheck {
38111
38098
  template <class TA, class TB, class TR>
@@ -38217,7 +38204,7 @@ bool TryMultiplyOperator::Operation(int16_t left, int16_t right, int16_t &result
38217
38204
  template <>
38218
38205
  bool TryMultiplyOperator::Operation(int32_t left, int32_t right, int32_t &result);
38219
38206
  template <>
38220
- bool TryMultiplyOperator::Operation(int64_t left, int64_t right, int64_t &result);
38207
+ DUCKDB_API bool TryMultiplyOperator::Operation(int64_t left, int64_t right, int64_t &result);
38221
38208
 
38222
38209
  struct MultiplyOperatorOverflowCheck {
38223
38210
  template <class TA, class TB, class TR>
@@ -39497,7 +39484,12 @@ timestamp_t Timestamp::FromDatetime(date_t date, dtime_t time) {
39497
39484
 
39498
39485
  void Timestamp::Convert(timestamp_t timestamp, date_t &out_date, dtime_t &out_time) {
39499
39486
  out_date = GetDate(timestamp);
39500
- out_time = dtime_t(timestamp.value - (int64_t(out_date.days) * int64_t(Interval::MICROS_PER_DAY)));
39487
+ int64_t days_micros;
39488
+ if (!TryMultiplyOperator::Operation<int64_t, int64_t, int64_t>(out_date.days, Interval::MICROS_PER_DAY,
39489
+ days_micros)) {
39490
+ throw ConversionException("Date out of range in timestamp conversion");
39491
+ }
39492
+ out_time = dtime_t(timestamp.value - days_micros);
39501
39493
  D_ASSERT(timestamp == Timestamp::FromDatetime(out_date, out_time));
39502
39494
  }
39503
39495
 
@@ -69880,9 +69872,14 @@ protected:
69880
69872
  } // namespace duckdb
69881
69873
 
69882
69874
 
69875
+
69883
69876
  namespace duckdb {
69884
69877
 
69885
69878
  unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalExport &op) {
69879
+ auto &config = DBConfig::GetConfig(context);
69880
+ if (!config.enable_external_access) {
69881
+ throw PermissionException("Export is disabled through configuration");
69882
+ }
69886
69883
  auto export_node = make_unique<PhysicalExport>(op.types, op.function, move(op.copy_info), op.estimated_cardinality,
69887
69884
  op.exported_tables);
69888
69885
  // plan the underlying copy statements, if any
@@ -81429,6 +81426,7 @@ void PragmaFunctions::RegisterFunction(BuiltinFunctions &set) {
81429
81426
 
81430
81427
 
81431
81428
 
81429
+
81432
81430
  namespace duckdb {
81433
81431
 
81434
81432
  string PragmaTableInfo(ClientContext &context, const FunctionParameters &parameters) {
@@ -81469,6 +81467,10 @@ string PragmaVersion(ClientContext &context, const FunctionParameters &parameter
81469
81467
  }
81470
81468
 
81471
81469
  string PragmaImportDatabase(ClientContext &context, const FunctionParameters &parameters) {
81470
+ auto &config = DBConfig::GetConfig(context);
81471
+ if (!config.enable_external_access) {
81472
+ throw PermissionException("Import is disabled through configuration");
81473
+ }
81472
81474
  auto &fs = FileSystem::GetFileSystem(context);
81473
81475
  auto *opener = FileSystem::GetFileOpener(context);
81474
81476
 
@@ -97079,6 +97081,7 @@ void CSVCopyFunction::RegisterFunction(BuiltinFunctions &set) {
97079
97081
 
97080
97082
 
97081
97083
 
97084
+
97082
97085
  namespace duckdb {
97083
97086
 
97084
97087
  struct GlobFunctionBindData : public TableFunctionData {
@@ -97090,6 +97093,10 @@ static unique_ptr<FunctionData> GlobFunctionBind(ClientContext &context, vector<
97090
97093
  vector<LogicalType> &input_table_types,
97091
97094
  vector<string> &input_table_names, vector<LogicalType> &return_types,
97092
97095
  vector<string> &names) {
97096
+ auto &config = DBConfig::GetConfig(context);
97097
+ if (!config.enable_external_access) {
97098
+ throw PermissionException("Globbing is disabled through configuration");
97099
+ }
97093
97100
  auto result = make_unique<GlobFunctionBindData>();
97094
97101
  auto &fs = FileSystem::GetFileSystem(context);
97095
97102
  result->files = fs.Glob(inputs[0].str_value);
@@ -97880,6 +97887,10 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, vector<Value
97880
97887
  unordered_map<string, Value> &named_parameters,
97881
97888
  vector<LogicalType> &input_table_types, vector<string> &input_table_names,
97882
97889
  vector<LogicalType> &return_types, vector<string> &names) {
97890
+ auto &config = DBConfig::GetConfig(context);
97891
+ if (!config.enable_external_access) {
97892
+ throw PermissionException("Scanning CSV files is disabled through configuration");
97893
+ }
97883
97894
  auto result = make_unique<ReadCSVData>();
97884
97895
  auto &options = result->options;
97885
97896
 
@@ -113737,7 +113748,7 @@ const vector<string> ExtensionHelper::PATH_COMPONENTS = {".duckdb", "extensions"
113737
113748
  void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &extension, bool force_install) {
113738
113749
  auto &config = DBConfig::GetConfig(db);
113739
113750
  if (!config.enable_external_access) {
113740
- throw Exception("Installing extensions is disabled");
113751
+ throw PermissionException("Installing extensions is disabled through configuration");
113741
113752
  }
113742
113753
  auto &fs = FileSystem::GetFileSystem(db);
113743
113754
 
@@ -113876,7 +113887,7 @@ static T LoadFunctionFromDLL(void *dll, const string &function_name, const strin
113876
113887
  void ExtensionHelper::LoadExternalExtension(DatabaseInstance &db, const string &extension) {
113877
113888
  auto &config = DBConfig::GetConfig(db);
113878
113889
  if (!config.enable_external_access) {
113879
- throw Exception("Loading external extensions is disabled");
113890
+ throw PermissionException("Loading external extensions is disabled through configuration");
113880
113891
  }
113881
113892
  auto &fs = FileSystem::GetFileSystem(db);
113882
113893
  auto filename = fs.ConvertSeparators(extension);
@@ -117750,10 +117761,11 @@ Value DisabledOptimizersSetting::GetSetting(ClientContext &context) {
117750
117761
  // Enable External Access
117751
117762
  //===--------------------------------------------------------------------===//
117752
117763
  void EnableExternalAccessSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) {
117753
- if (db) {
117764
+ auto new_value = input.GetValue<bool>();
117765
+ if (db && new_value) {
117754
117766
  throw InvalidInputException("Cannot change enable_external_access setting while database is running");
117755
117767
  }
117756
- config.enable_external_access = input.GetValue<bool>();
117768
+ config.enable_external_access = new_value;
117757
117769
  }
117758
117770
 
117759
117771
  Value EnableExternalAccessSetting::GetSetting(ClientContext &context) {
@@ -150187,7 +150199,8 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundRecursiveCTENode &node) {
150187
150199
  left_node = CastLogicalOperatorToTypes(node.left->types, node.types, move(left_node));
150188
150200
  right_node = CastLogicalOperatorToTypes(node.right->types, node.types, move(right_node));
150189
150201
 
150190
- if (node.right_binder->bind_context.cte_references[node.ctename] == nullptr) {
150202
+ if (!node.right_binder->bind_context.cte_references[node.ctename] ||
150203
+ *node.right_binder->bind_context.cte_references[node.ctename] == 0) {
150191
150204
  auto root = make_unique<LogicalSetOperation>(node.setop_index, node.types.size(), move(left_node),
150192
150205
  move(right_node), LogicalOperatorType::LOGICAL_UNION);
150193
150206
  return VisitQueryNode(node, move(root));
@@ -150914,7 +150927,7 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
150914
150927
  // COPY TO a file
150915
150928
  auto &config = DBConfig::GetConfig(context);
150916
150929
  if (!config.enable_external_access) {
150917
- throw Exception("COPY TO is disabled by configuration");
150930
+ throw PermissionException("COPY TO is disabled by configuration");
150918
150931
  }
150919
150932
  BoundStatement result;
150920
150933
  result.types = {LogicalType::BIGINT};
@@ -150944,7 +150957,7 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
150944
150957
  BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
150945
150958
  auto &config = DBConfig::GetConfig(context);
150946
150959
  if (!config.enable_external_access) {
150947
- throw Exception("COPY FROM is disabled by configuration");
150960
+ throw PermissionException("COPY FROM is disabled by configuration");
150948
150961
  }
150949
150962
  BoundStatement result;
150950
150963
  result.types = {LogicalType::BIGINT};
@@ -151776,7 +151789,7 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
151776
151789
  // COPY TO a file
151777
151790
  auto &config = DBConfig::GetConfig(context);
151778
151791
  if (!config.enable_external_access) {
151779
- throw Exception("COPY TO is disabled by configuration");
151792
+ throw PermissionException("COPY TO is disabled through configuration");
151780
151793
  }
151781
151794
  BoundStatement result;
151782
151795
  result.types = {LogicalType::BOOLEAN};
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "7a4c1fbf0"
14
- #define DUCKDB_VERSION "0.3.2-dev502"
13
+ #define DUCKDB_SOURCE_ID "0546552f6"
14
+ #define DUCKDB_VERSION "0.3.2-dev528"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //
@@ -1146,7 +1146,7 @@ bool IsValidType() {
1146
1146
  extern const LogicalType LOGICAL_ROW_TYPE;
1147
1147
  extern const PhysicalType ROW_TYPE;
1148
1148
 
1149
- string TypeIdToString(PhysicalType type);
1149
+ DUCKDB_API string TypeIdToString(PhysicalType type);
1150
1150
  idx_t GetTypeIdSize(PhysicalType type);
1151
1151
  bool TypeIsConstantSize(PhysicalType type);
1152
1152
  bool TypeIsIntegral(PhysicalType type);
@@ -1270,7 +1270,8 @@ enum class ExceptionType {
1270
1270
  INTERNAL =
1271
1271
  31, // Internal exception: exception that indicates something went wrong internally (i.e. bug in the code base)
1272
1272
  INVALID_INPUT = 32, // Input or arguments error
1273
- OUT_OF_MEMORY = 33 // out of memory
1273
+ OUT_OF_MEMORY = 33, // out of memory
1274
+ PERMISSION = 34 // insufficient permissions
1274
1275
  };
1275
1276
 
1276
1277
  class Exception : public std::exception {
@@ -1334,6 +1335,16 @@ public:
1334
1335
  }
1335
1336
  };
1336
1337
 
1338
+ class PermissionException : public StandardException {
1339
+ public:
1340
+ DUCKDB_API explicit PermissionException(const string &msg);
1341
+
1342
+ template <typename... Args>
1343
+ explicit PermissionException(const string &msg, Args... params)
1344
+ : PermissionException(ConstructMessage(msg, params...)) {
1345
+ }
1346
+ };
1347
+
1337
1348
  class BinderException : public StandardException {
1338
1349
  public:
1339
1350
  DUCKDB_API explicit BinderException(const string &msg);