Skip to content

Commit

Permalink
fix: hoist function settings with memory units properly
Browse files Browse the repository at this point in the history
f9ee1f7 introduced the hoisting of function settings as transaction-scoped
settings. However, this currently doesn't work with memory units, which are
case-sensitive according to the docs [1]. This removes the lowercasing of
values to make them work.

This is not added to the CHANGELOG, because this feature was not released, yet.

[1]: https://www.postgresql.org/docs/current/config-setting.html#CONFIG-SETTING-NAMES-VALUES
  • Loading branch information
wolfgangwalther committed Apr 20, 2024
1 parent de788c9 commit ed40735
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PostgREST/SchemaCache.hs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ funcsSqlQuery pgVer = [q|
SELECT
array_agg(row(
substr(setting, 1, strpos(setting, '=') - 1),
lower(substr(setting, strpos(setting, '=') + 1))
substr(setting, strpos(setting, '=') + 1)
)) as kvs
FROM unnest(proconfig) setting
WHERE setting not LIKE 'default_transaction_isolation%'
Expand Down
2 changes: 1 addition & 1 deletion test/io/fixtures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ $$ language sql;

create or replace function work_mem_test() returns text as $$
select current_setting('work_mem',false);
$$ language sql set work_mem = '6000';
$$ language sql set work_mem = '6000kB';

create or replace function multiple_func_settings_test() returns setof record as $$
select current_setting('work_mem',false) as work_mem,
Expand Down

0 comments on commit ed40735

Please sign in to comment.