RLS without leakproof restrictions? - Mailing list pgsql-general

From Tom Dunstan
Subject RLS without leakproof restrictions?
Date
Msg-id CAPPfruzMB1RQ0LMjHQe=MT1KhDHzaT_gduaMa20dbxC8f6B7og@mail.gmail.com
Whole thread Raw
Responses Re: RLS without leakproof restrictions?  ("Martin L. Buchanan" <martinlbuchanan@gmail.com>)
Re: RLS without leakproof restrictions?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: RLS without leakproof restrictions?  (Stephen Frost <sfrost@snowman.net>)
List pgsql-general
Hi all

I'm currently researching different strategies for retrofitting some multi-tenant functionality into our existing Postgres-backed application. One of the options is using RLS policies to do row filtering. This is quite attractive as I dread the maintenance and auditing burden of adding filtering clauses to the majority of our queries. I'm somewhat concerned though about getting unexpected query plans based on the planner avoiding non-leakproof functions until row filtering has occurred - warning about this seems common in articles on RLS.

Our application is the only "user" of the database, and we do not pass database errors through to the user interface, so for our case leakproof plans are overkill - we'd just like the implicit filtering clauses added based on some session GUCs that we set.

Is there any way to get what we're looking for here? I don't see anything documented on CREATE POLICY, ALTER TABLE or any GUCs.

Alternatively, are the concerns about changed plans unfounded? For example we don't use many expression indexes or exotic types, it's mostly btrees on text and ints. We do use tsearch a certain amount, but constructing tsvectors and tsqueries manually rather than through stemmers etc.

Thanks

Tom

pgsql-general by date:

Previous
From: Bryn Llewellyn
Date:
Subject: Re: transaction_isolation vs. default_transaction_isolation
Next
From: Cathy Xie
Date:
Subject: Re: Debugging postgres on Windows - could not open directory "/lib"