duckdb 0.8.2-dev4126.0 → 0.8.2-dev4142.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/src/catalog/catalog.cpp +20 -0
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +3 -0
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +1 -0
- package/src/duckdb/src/main/extension/extension_helper.cpp +17 -0
- package/src/duckdb/src/main/extension/extension_install.cpp +5 -3
- package/src/duckdb/src/main/extension/extension_load.cpp +3 -3
package/package.json
CHANGED
@@ -431,6 +431,26 @@ void FindMinimalQualification(ClientContext &context, const string &catalog_name
|
|
431
431
|
qualify_schema = true;
|
432
432
|
}
|
433
433
|
|
434
|
+
bool Catalog::TryAutoLoad(ClientContext &context, const string &extension_name) noexcept {
|
435
|
+
if (context.db->ExtensionIsLoaded(extension_name)) {
|
436
|
+
return true;
|
437
|
+
}
|
438
|
+
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
|
439
|
+
auto &dbconfig = DBConfig::GetConfig(context);
|
440
|
+
if (!dbconfig.options.autoload_known_extensions) {
|
441
|
+
return false;
|
442
|
+
}
|
443
|
+
try {
|
444
|
+
if (ExtensionHelper::CanAutoloadExtension(extension_name)) {
|
445
|
+
return ExtensionHelper::TryAutoLoadExtension(context, extension_name);
|
446
|
+
}
|
447
|
+
} catch (...) {
|
448
|
+
return false;
|
449
|
+
}
|
450
|
+
#endif
|
451
|
+
return false;
|
452
|
+
}
|
453
|
+
|
434
454
|
void Catalog::AutoloadExtensionByConfigName(ClientContext &context, const string &configuration_name) {
|
435
455
|
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
|
436
456
|
auto &dbconfig = DBConfig::GetConfig(context);
|
@@ -139,6 +139,9 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
139
139
|
case LogicalTypeId::DATE:
|
140
140
|
child.format = "tdD";
|
141
141
|
break;
|
142
|
+
#ifdef DUCKDB_WASM
|
143
|
+
case LogicalTypeId::TIME_TZ:
|
144
|
+
#endif
|
142
145
|
case LogicalTypeId::TIME:
|
143
146
|
child.format = "ttu";
|
144
147
|
break;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.8.2-
|
2
|
+
#define DUCKDB_VERSION "0.8.2-dev4142"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "d5c4422f72"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -305,6 +305,7 @@ public:
|
|
305
305
|
static void AutoloadExtensionByConfigName(ClientContext &context, const string &configuration_name);
|
306
306
|
//! Autoload the extension required for `function_name` or throw a CatalogException
|
307
307
|
static bool AutoLoadExtensionByCatalogEntry(ClientContext &context, CatalogType type, const string &entry_name);
|
308
|
+
DUCKDB_API static bool TryAutoLoad(ClientContext &context, const string &extension_name) noexcept;
|
308
309
|
|
309
310
|
protected:
|
310
311
|
//! Reference to the database
|
@@ -51,6 +51,7 @@ public:
|
|
51
51
|
|
52
52
|
//! Autoload an extension by name. Depending on the current settings, this will either load or install+load
|
53
53
|
static void AutoLoadExtension(ClientContext &context, const string &extension_name);
|
54
|
+
DUCKDB_API static bool TryAutoLoadExtension(ClientContext &context, const string &extension_name) noexcept;
|
54
55
|
|
55
56
|
static string ExtensionDirectory(ClientContext &context);
|
56
57
|
static string ExtensionDirectory(DBConfig &config, FileSystem &fs);
|
@@ -194,13 +194,30 @@ string ExtensionHelper::AddExtensionInstallHintToErrorMsg(ClientContext &context
|
|
194
194
|
return base_error;
|
195
195
|
}
|
196
196
|
|
197
|
+
bool ExtensionHelper::TryAutoLoadExtension(ClientContext &context, const string &extension_name) noexcept {
|
198
|
+
auto &dbconfig = DBConfig::GetConfig(context);
|
199
|
+
try {
|
200
|
+
if (dbconfig.options.autoinstall_known_extensions) {
|
201
|
+
ExtensionHelper::InstallExtension(context, extension_name, false,
|
202
|
+
context.config.autoinstall_extension_repo);
|
203
|
+
}
|
204
|
+
ExtensionHelper::LoadExternalExtension(context, extension_name);
|
205
|
+
return true;
|
206
|
+
} catch (...) {
|
207
|
+
return false;
|
208
|
+
}
|
209
|
+
return false;
|
210
|
+
}
|
211
|
+
|
197
212
|
void ExtensionHelper::AutoLoadExtension(ClientContext &context, const string &extension_name) {
|
198
213
|
auto &dbconfig = DBConfig::GetConfig(context);
|
199
214
|
try {
|
215
|
+
#ifndef DUCKDB_WASM
|
200
216
|
if (dbconfig.options.autoinstall_known_extensions) {
|
201
217
|
ExtensionHelper::InstallExtension(context, extension_name, false,
|
202
218
|
context.config.autoinstall_extension_repo);
|
203
219
|
}
|
220
|
+
#endif
|
204
221
|
ExtensionHelper::LoadExternalExtension(context, extension_name);
|
205
222
|
} catch (Exception &e) {
|
206
223
|
throw AutoloadException(extension_name, e);
|
@@ -45,7 +45,7 @@ const vector<string> ExtensionHelper::PathComponents() {
|
|
45
45
|
|
46
46
|
string ExtensionHelper::ExtensionDirectory(DBConfig &config, FileSystem &fs) {
|
47
47
|
#ifdef WASM_LOADABLE_EXTENSIONS
|
48
|
-
|
48
|
+
throw PermissionException("ExtensionDirectory functionality is not supported in duckdb-wasm");
|
49
49
|
#endif
|
50
50
|
string extension_directory;
|
51
51
|
if (!config.options.extension_directory.empty()) { // create the extension directory if not present
|
@@ -159,9 +159,11 @@ void WriteExtensionFileToDisk(FileSystem &fs, const string &path, void *data, id
|
|
159
159
|
|
160
160
|
string ExtensionHelper::ExtensionUrlTemplate(optional_ptr<const ClientConfig> client_config, const string &repository) {
|
161
161
|
string default_endpoint = "http://extensions.duckdb.org";
|
162
|
-
string versioned_path = "/${REVISION}/${PLATFORM}/${NAME}.duckdb_extension
|
162
|
+
string versioned_path = "/${REVISION}/${PLATFORM}/${NAME}.duckdb_extension";
|
163
163
|
#ifdef WASM_LOADABLE_EXTENSIONS
|
164
|
-
versioned_path = "/duckdb-wasm" + versioned_path;
|
164
|
+
versioned_path = "/duckdb-wasm" + versioned_path + ".wasm";
|
165
|
+
#else
|
166
|
+
versioned_path = versioned_path + ".gz";
|
165
167
|
#endif
|
166
168
|
string custom_endpoint = client_config ? client_config->custom_extension_repo : string();
|
167
169
|
string endpoint;
|
@@ -70,14 +70,15 @@ bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileSystem &fs, const str
|
|
70
70
|
|
71
71
|
// shorthand case
|
72
72
|
if (!ExtensionHelper::IsFullPath(extension)) {
|
73
|
+
string extension_name = ApplyExtensionAlias(extension);
|
73
74
|
#ifdef WASM_LOADABLE_EXTENSIONS
|
74
75
|
string url_template = ExtensionUrlTemplate(client_config, "");
|
75
76
|
string url = ExtensionFinalizeUrlTemplate(url_template, extension_name);
|
76
77
|
|
77
78
|
char *str = (char *)EM_ASM_PTR(
|
78
79
|
{
|
79
|
-
var jsString = ((typeof runtime ==
|
80
|
-
|
80
|
+
var jsString = ((typeof runtime == 'object') && runtime && (typeof runtime.whereToLoad == 'function') &&
|
81
|
+
runtime.whereToLoad)
|
81
82
|
? runtime.whereToLoad(UTF8ToString($0))
|
82
83
|
: (UTF8ToString($1));
|
83
84
|
var lengthBytes = lengthBytesUTF8(jsString) + 1;
|
@@ -105,7 +106,6 @@ bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileSystem &fs, const str
|
|
105
106
|
for (auto &path_ele : path_components) {
|
106
107
|
local_path = fs.JoinPath(local_path, path_ele);
|
107
108
|
}
|
108
|
-
string extension_name = ApplyExtensionAlias(extension);
|
109
109
|
filename = fs.JoinPath(local_path, extension_name + ".duckdb_extension");
|
110
110
|
#endif
|
111
111
|
}
|