pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alastair McKinley <a.mckinley@analyticsengines.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Index selection issues with RLS using expressions
Date: Tue, 31 Mar 2020 15:18:22 -0400
Message-ID: <23829.1585682302@sss.pgh.pa.us> (raw)
In-Reply-To: <PR1PR02MB534059127D2BA0B8D926413EE3C80@PR1PR02MB5340.eurprd02.prod.outlook.com>
References: <PR1PR02MB534059127D2BA0B8D926413EE3C80@PR1PR02MB5340.eurprd02.prod.outlook.com>

Alastair McKinley <a.mckinley@analyticsengines.com> writes:
> I am running in to an issue with RLS and index selection in my queries.  I created a toy example to try to illustrate the issue below.  Postgres version is PostgreSQL 12.2 (Debian 12.2-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit.

> Is there some subtle reason as to why the role "new_user" cannot seem to generate a query plan that uses the gin index?

The && operator is not marked leakproof, so it can't be applied till
after the RLS filter, making an indexscan with it impossible when
RLS is active.

Perhaps arrayoverlap() itself could be proven leakproof, but the
underlying type-specific equality operator might or might not be.
We don't have enough infrastructure to handle indirect leakproofness
requirements like that, so you lose :-(

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <23829.1585682302@sss.pgh.pa.us>
Permalink:  ../23829.1585682302@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23829.1585682302@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, a.mckinley@analyticsengines.com
  Subject: Re: Index selection issues with RLS using expressions
  In-Reply-To: <23829.1585682302@sss.pgh.pa.us>
  References: <PR1PR02MB534059127D2BA0B8D926413EE3C80@PR1PR02MB5340.eurprd02.prod.outlook.com> <23829.1585682302@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox