From ed407350ad6587eaef363a0c613576f0d65aa8da Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 20 Apr 2024 13:54:24 +0200 Subject: [PATCH] fix: hoist function settings with memory units properly f9ee1f7e 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 --- src/PostgREST/SchemaCache.hs | 2 +- test/io/fixtures.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PostgREST/SchemaCache.hs b/src/PostgREST/SchemaCache.hs index 3e27c13dd..055d02a7c 100644 --- a/src/PostgREST/SchemaCache.hs +++ b/src/PostgREST/SchemaCache.hs @@ -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%' diff --git a/test/io/fixtures.sql b/test/io/fixtures.sql index 636505664..613d383b6 100644 --- a/test/io/fixtures.sql +++ b/test/io/fixtures.sql @@ -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,