Skip to content

Commit

Permalink
Do not set max_memory if given the empty string (#614)
Browse files Browse the repository at this point in the history
This was already the intended behaviour, as the already existing NULL
check shows. The value of a GUC is never NULL though, but can be an
empty string. This keeps the NULL check for safety purposes.
  • Loading branch information
JelteF authored Feb 18, 2025
1 parent 7b1ea5a commit 82d3a0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Since any connection that uses DuckDB will have its own DuckDB instance, these s

### `duckdb.max_memory` / `duckdb.memory_limit`

The maximum memory DuckDB can use within a single Postgres connection. This is somewhat comparable to Postgres its `work_mem` setting.
The maximum memory DuckDB can use within a single Postgres connection. This is somewhat comparable to Postgres its `work_mem` setting. When set to the empty string, this will use DuckDB its normal default which is 80% of RAM.

Default: `"4GB"`

Expand Down
2 changes: 1 addition & 1 deletion src/pgduckdb_duckdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ DuckDBManager::Initialize() {
SET_DUCKDB_OPTION(autoinstall_known_extensions);
SET_DUCKDB_OPTION(autoload_known_extensions);

if (duckdb_maximum_memory != NULL) {
if (duckdb_maximum_memory != NULL && strlen(duckdb_maximum_memory) == 0) {
config.options.maximum_memory = duckdb::DBConfig::ParseMemoryLimit(duckdb_maximum_memory);
elog(DEBUG2, "[PGDuckDB] Set DuckDB option: 'maximum_memory'=%s", duckdb_maximum_memory);
}
Expand Down

0 comments on commit 82d3a0f

Please sign in to comment.