Hello:
I'm enthusiastic about the PostgreSQL project and this is my first bug report. Please apologize if I'm on the wrong channel.
The bug is the following: when I set a custom variable using the configuration settings functions within a transaction, after I commit the transaction, instead of the variable becoming null, it becomes an empty string.
How to reproduce:
SELECT current_setting('custom.user_id', true)::INTEGER; -- NULL
BEGIN;
SELECT set_config('custom.user_id', '2', true);
SELECT current_setting('custom.user_id', true)::INTEGER; -- 2
END;
SELECT current_setting('custom.user_id', true)::INTEGER; -- Empty string instead of null
PostgreSQL version: PostgreSQL 15.10 (Debian 15.10-0+deb12u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit