Thread: [GENERAL] Querying a policy

[GENERAL] Querying a policy

From
Jean-Francois Bernier
Date:

Hi all!

 

We are evaluating migrating our software RLS to Postgres by using policies.

 

Having a "FOR UPDATE POLICY" on a table, I was wondering if there is a way to know, before trying an Update and getting an error, if the current row can be updated ?

 

The goal is to show or hide the edit button in my software forms or lists.

 

I know that this query can return the CHECK condition of my POLICY:

SELECT pg_get_expr(polwithcheck, polrelid, true) FROM pg_policy;

 

But is there a simpler way to get the ids the current user can read and the ones that he can update?

 

Thank you!

 

Jeff