Can I use Postgres rules to reset session variables before/after queries?

2021-01-24 Thread Andrew Stuart
I am using Postgres row level security and I wish to ensure it is not possible for a specific session variable (that holds a tenant id) to remain set in between transactions / queries. The reason is because this is a web application that pools sessions and the session is shared between user web qu

How can I use Postgres "ROLLBACK TO SAVEPOINT" with "FOR UPDATE SKIP LOCKED"?

2018-08-25 Thread Andrew Stuart
Postgres 10 I am trying to use "FOR UPDATE SKIP LOCKED" to make a work queue in Postgres. My goal is to be able to set status to 'complete' or 'failed' as the outcome by using "ROLLBACK TO SAVEPOINT;" in the event that processing fails. I expected the code below to result in a final status of "