Querying a policy

From: Jean-Francois Bernier <jean(dot)francois(dot)bernier(at)boreal-is(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Querying a policy
Date: 2017-05-10 20:34:29
Message-ID: BN6PR02MB2705D93170FB17E561665CDCFDEC0@BN6PR02MB2705.namprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-05-10 21:02:11 Re: Logical decoding CPU-bound w/ large number of tables
Previous Message Paul Hughes 2017-05-10 19:46:36 Re: Python versus Other Languages using PostgreSQL