SET LOCAL doesn't become undefined after transaction is commited
| От | Kostya |
|---|---|
| Тема | SET LOCAL doesn't become undefined after transaction is commited |
| Дата | |
| Msg-id | CAB_pDVVa84w7hXhzvyuMTb8f5kKV3bee_p9QTZZ58Rg7zYM7sw@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: SET LOCAL doesn't become undefined after transaction is commited
|
| Список | pgsql-general |
Hi
We are using dynamic settings via SET LOCAL for row level security.
I would like to clarify that I'm seeing the correct behaviour
I create a new session to the database, I run the following query:
SELECT current_setting("session.my_tenant_id");
I will get the following error:
pq: unrecognized configuration parameter \"session.my_tenant_id\"
However, once I run the following transaction
BEGIN READ WRITE
SET LOCAL session.my_tenant_id="f00";
SELECT * FROM someTable;
COMMIT;
Then
SELECT current_setting("session.my_tenant_id");
will return an empty string "". Basically "session.my_tenant_id" becomes defined.
Is this supposed to work like this or could this be a bug?
Is it possible to entirely undefine "session.my_tenant_id" after the transaction was committed? Basically I would like to return to the initial state of the PSQL connection.
Thanks in advance.
В списке pgsql-general по дате отправления: