Re: SET LOCAL doesn't become undefined after transaction is commited

2020-03-18 Thread Kostya
Thanks for the elaborate response. I don't define many variables, basically only a single one. We've implemented multi tenancy using row level policy and by utilizing the SET LOCAL variable to pass the tenant id to enforce querying the right tenant. For example in the table "stuff" I have a colum

Re: SET LOCAL doesn't become undefined after transaction is commited

2020-03-18 Thread Tom Lane
Kostya writes: > 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 > defi

SET LOCAL doesn't become undefined after transaction is commited

2020-03-18 Thread Kostya
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