duckdb 0.3.2-dev521.0 → 0.3.2-dev524.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 +1 -1
- package/src/duckdb.cpp +32 -7
- package/src/duckdb.hpp +14 -3
package/package.json
CHANGED
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
|
|
|
@@ -69885,9 +69890,14 @@ protected:
|
|
|
69885
69890
|
} // namespace duckdb
|
|
69886
69891
|
|
|
69887
69892
|
|
|
69893
|
+
|
|
69888
69894
|
namespace duckdb {
|
|
69889
69895
|
|
|
69890
69896
|
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalExport &op) {
|
|
69897
|
+
auto &config = DBConfig::GetConfig(context);
|
|
69898
|
+
if (!config.enable_external_access) {
|
|
69899
|
+
throw PermissionException("Export is disabled through configuration");
|
|
69900
|
+
}
|
|
69891
69901
|
auto export_node = make_unique<PhysicalExport>(op.types, op.function, move(op.copy_info), op.estimated_cardinality,
|
|
69892
69902
|
op.exported_tables);
|
|
69893
69903
|
// plan the underlying copy statements, if any
|
|
@@ -81434,6 +81444,7 @@ void PragmaFunctions::RegisterFunction(BuiltinFunctions &set) {
|
|
|
81434
81444
|
|
|
81435
81445
|
|
|
81436
81446
|
|
|
81447
|
+
|
|
81437
81448
|
namespace duckdb {
|
|
81438
81449
|
|
|
81439
81450
|
string PragmaTableInfo(ClientContext &context, const FunctionParameters ¶meters) {
|
|
@@ -81474,6 +81485,10 @@ string PragmaVersion(ClientContext &context, const FunctionParameters ¶meter
|
|
|
81474
81485
|
}
|
|
81475
81486
|
|
|
81476
81487
|
string PragmaImportDatabase(ClientContext &context, const FunctionParameters ¶meters) {
|
|
81488
|
+
auto &config = DBConfig::GetConfig(context);
|
|
81489
|
+
if (!config.enable_external_access) {
|
|
81490
|
+
throw PermissionException("Import is disabled through configuration");
|
|
81491
|
+
}
|
|
81477
81492
|
auto &fs = FileSystem::GetFileSystem(context);
|
|
81478
81493
|
auto *opener = FileSystem::GetFileOpener(context);
|
|
81479
81494
|
|
|
@@ -97084,6 +97099,7 @@ void CSVCopyFunction::RegisterFunction(BuiltinFunctions &set) {
|
|
|
97084
97099
|
|
|
97085
97100
|
|
|
97086
97101
|
|
|
97102
|
+
|
|
97087
97103
|
namespace duckdb {
|
|
97088
97104
|
|
|
97089
97105
|
struct GlobFunctionBindData : public TableFunctionData {
|
|
@@ -97095,6 +97111,10 @@ static unique_ptr<FunctionData> GlobFunctionBind(ClientContext &context, vector<
|
|
|
97095
97111
|
vector<LogicalType> &input_table_types,
|
|
97096
97112
|
vector<string> &input_table_names, vector<LogicalType> &return_types,
|
|
97097
97113
|
vector<string> &names) {
|
|
97114
|
+
auto &config = DBConfig::GetConfig(context);
|
|
97115
|
+
if (!config.enable_external_access) {
|
|
97116
|
+
throw PermissionException("Globbing is disabled through configuration");
|
|
97117
|
+
}
|
|
97098
97118
|
auto result = make_unique<GlobFunctionBindData>();
|
|
97099
97119
|
auto &fs = FileSystem::GetFileSystem(context);
|
|
97100
97120
|
result->files = fs.Glob(inputs[0].str_value);
|
|
@@ -97885,6 +97905,10 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, vector<Value
|
|
|
97885
97905
|
unordered_map<string, Value> &named_parameters,
|
|
97886
97906
|
vector<LogicalType> &input_table_types, vector<string> &input_table_names,
|
|
97887
97907
|
vector<LogicalType> &return_types, vector<string> &names) {
|
|
97908
|
+
auto &config = DBConfig::GetConfig(context);
|
|
97909
|
+
if (!config.enable_external_access) {
|
|
97910
|
+
throw PermissionException("Scanning CSV files is disabled through configuration");
|
|
97911
|
+
}
|
|
97888
97912
|
auto result = make_unique<ReadCSVData>();
|
|
97889
97913
|
auto &options = result->options;
|
|
97890
97914
|
|
|
@@ -113742,7 +113766,7 @@ const vector<string> ExtensionHelper::PATH_COMPONENTS = {".duckdb", "extensions"
|
|
|
113742
113766
|
void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &extension, bool force_install) {
|
|
113743
113767
|
auto &config = DBConfig::GetConfig(db);
|
|
113744
113768
|
if (!config.enable_external_access) {
|
|
113745
|
-
throw
|
|
113769
|
+
throw PermissionException("Installing extensions is disabled through configuration");
|
|
113746
113770
|
}
|
|
113747
113771
|
auto &fs = FileSystem::GetFileSystem(db);
|
|
113748
113772
|
|
|
@@ -113881,7 +113905,7 @@ static T LoadFunctionFromDLL(void *dll, const string &function_name, const strin
|
|
|
113881
113905
|
void ExtensionHelper::LoadExternalExtension(DatabaseInstance &db, const string &extension) {
|
|
113882
113906
|
auto &config = DBConfig::GetConfig(db);
|
|
113883
113907
|
if (!config.enable_external_access) {
|
|
113884
|
-
throw
|
|
113908
|
+
throw PermissionException("Loading external extensions is disabled through configuration");
|
|
113885
113909
|
}
|
|
113886
113910
|
auto &fs = FileSystem::GetFileSystem(db);
|
|
113887
113911
|
auto filename = fs.ConvertSeparators(extension);
|
|
@@ -117755,10 +117779,11 @@ Value DisabledOptimizersSetting::GetSetting(ClientContext &context) {
|
|
|
117755
117779
|
// Enable External Access
|
|
117756
117780
|
//===--------------------------------------------------------------------===//
|
|
117757
117781
|
void EnableExternalAccessSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) {
|
|
117758
|
-
|
|
117782
|
+
auto new_value = input.GetValue<bool>();
|
|
117783
|
+
if (db && new_value) {
|
|
117759
117784
|
throw InvalidInputException("Cannot change enable_external_access setting while database is running");
|
|
117760
117785
|
}
|
|
117761
|
-
config.enable_external_access =
|
|
117786
|
+
config.enable_external_access = new_value;
|
|
117762
117787
|
}
|
|
117763
117788
|
|
|
117764
117789
|
Value EnableExternalAccessSetting::GetSetting(ClientContext &context) {
|
|
@@ -150920,7 +150945,7 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
|
|
|
150920
150945
|
// COPY TO a file
|
|
150921
150946
|
auto &config = DBConfig::GetConfig(context);
|
|
150922
150947
|
if (!config.enable_external_access) {
|
|
150923
|
-
throw
|
|
150948
|
+
throw PermissionException("COPY TO is disabled by configuration");
|
|
150924
150949
|
}
|
|
150925
150950
|
BoundStatement result;
|
|
150926
150951
|
result.types = {LogicalType::BIGINT};
|
|
@@ -150950,7 +150975,7 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) {
|
|
|
150950
150975
|
BoundStatement Binder::BindCopyFrom(CopyStatement &stmt) {
|
|
150951
150976
|
auto &config = DBConfig::GetConfig(context);
|
|
150952
150977
|
if (!config.enable_external_access) {
|
|
150953
|
-
throw
|
|
150978
|
+
throw PermissionException("COPY FROM is disabled by configuration");
|
|
150954
150979
|
}
|
|
150955
150980
|
BoundStatement result;
|
|
150956
150981
|
result.types = {LogicalType::BIGINT};
|
|
@@ -151782,7 +151807,7 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
|
|
|
151782
151807
|
// COPY TO a file
|
|
151783
151808
|
auto &config = DBConfig::GetConfig(context);
|
|
151784
151809
|
if (!config.enable_external_access) {
|
|
151785
|
-
throw
|
|
151810
|
+
throw PermissionException("COPY TO is disabled through configuration");
|
|
151786
151811
|
}
|
|
151787
151812
|
BoundStatement result;
|
|
151788
151813
|
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 "
|
|
14
|
-
#define DUCKDB_VERSION "0.3.2-
|
|
13
|
+
#define DUCKDB_SOURCE_ID "469e6a48f"
|
|
14
|
+
#define DUCKDB_VERSION "0.3.2-dev524"
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
// DuckDB
|
|
17
17
|
//
|
|
@@ -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
|
|
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);
|