| From: | Kostya <kostya(dot)y(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | SET LOCAL <var> doesn't become undefined after transaction is commited |
| Date: | 2020-03-18 11:22:20 |
| Message-ID: | CAB_pDVVa84w7hXhzvyuMTb8f5kKV3bee_p9QTZZ58Rg7zYM7sw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Norberto Dellê | 2020-03-18 13:57:22 | PostgreSQL 10 not archiving some WAL files |
| Previous Message | stan | 2020-03-18 10:47:52 | propogate RAISE levels < EXCEPTION through MS Access? |