-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update default settings #338
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
25d8a57
Update default settings
JelteF 6bd6c4c
Remove some test failures due to local filesystem
JelteF 05ac168
Don't ever set duckdb_disabled_filesystems for superusers
JelteF b7469d6
Only actually run INSTALL EXTENSION when calling duckdb.install_exten…
JelteF 642a1cf
Make duckdb.install_extension a no-op when the extension is already i…
JelteF 2afef18
Update src/pgduckdb_duckdb.cpp
JelteF 666ed03
Add test for disabled_filesystems=LocalFilestytem
JelteF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ extern "C" { | |
#include "access/relation.h" | ||
#include "access/table.h" | ||
#include "access/xact.h" | ||
#include "executor/spi.h" | ||
#include "catalog/indexing.h" | ||
#include "catalog/namespace.h" | ||
#include "utils/builtins.h" | ||
|
@@ -115,36 +116,25 @@ ReadDuckdbExtensions() { | |
} | ||
|
||
static bool | ||
DuckdbInstallExtension(Datum name) { | ||
DuckdbInstallExtension(Datum name_datum) { | ||
|
||
auto extension_name = DatumToString(name); | ||
auto extension_name = DatumToString(name_datum); | ||
auto install_extension_command = duckdb::StringUtil::Format("INSTALL %s;", extension_name.c_str()); | ||
{ | ||
auto connection = pgduckdb::DuckDBManager::CreateConnection(); | ||
auto res = connection->context->Query(install_extension_command, false); | ||
|
||
if (res->HasError()) { | ||
elog(WARNING, "(PGDuckDB/DuckdbInstallExtension) %s", res->GetError().c_str()); | ||
return false; | ||
} | ||
} | ||
|
||
bool nulls[Natts_duckdb_extension] = {0}; | ||
Datum values[Natts_duckdb_extension] = {0}; | ||
|
||
values[Anum_duckdb_extension_name - 1] = name; | ||
values[Anum_duckdb_extension_enable - 1] = 1; | ||
|
||
/* create heap tuple and insert into catalog table */ | ||
Relation duckdb_extensions_relation = relation_open(ExtensionsTableRelationId(), RowExclusiveLock); | ||
TupleDesc tuple_descr = RelationGetDescr(duckdb_extensions_relation); | ||
|
||
/* inserting extension record */ | ||
HeapTuple new_tuple = heap_form_tuple(tuple_descr, values, nulls); | ||
CatalogTupleInsert(duckdb_extensions_relation, new_tuple); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This low level API was not causing the trigger to be fired. So this PR actually also fixes a bug where the |
||
|
||
CommandCounterIncrement(); | ||
relation_close(duckdb_extensions_relation, RowExclusiveLock); | ||
pgduckdb::DuckDBQueryOrThrow(install_extension_command); | ||
Y-- marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Oid arg_types[] = {TEXTOID}; | ||
Datum values[] = {name_datum}; | ||
|
||
SPI_connect(); | ||
auto ret = SPI_execute_with_args(R"( | ||
INSERT INTO duckdb.extensions (name, enabled) | ||
VALUES ($1, true) | ||
ON CONFLICT (name) DO UPDATE SET enabled = true | ||
)", | ||
lengthof(arg_types), arg_types, values, NULL, false, 0); | ||
if (ret != SPI_OK_INSERT) | ||
elog(ERROR, "SPI_exec failed: error code %s", SPI_result_code_string(ret)); | ||
SPI_finish(); | ||
|
||
return true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
ExtensionsTableRelationId
still used somewhere now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
ReadDuckdbExtensions