pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Derek Hans <derek.hans@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: GIST/GIN index not used with Row Level Security
Date: Tue, 13 Aug 2019 19:03:16 -0400
Message-ID: <20190813230316.GQ16436@tamriel.snowman.net> (raw)
In-Reply-To: <CAGrP7a2kQ5vVUE=46xPU1LLJJ2GuYSREWsTY49WbfPV6R0sM3g@mail.gmail.com>
References: <CAGrP7a2t+JbeuxpQY+RSvNe4fr3+==UmyimwV0GCD+wcrSSb=w@mail.gmail.com>
	<12552.1565723566@sss.pgh.pa.us>
	<CAGrP7a3JcEorwM98OGn7s-TZ1os8rubCqeEXLgqeZrvX4LfwvQ@mail.gmail.com>
	<14241.1565725716@sss.pgh.pa.us>
	<CAGrP7a3ZZ5MaMi3LLmPy121K_YDYCkinu2gcq8PQzQqpGUuEkQ@mail.gmail.com>
	<20190813213930.GO16436@tamriel.snowman.net>
	<CAGrP7a2kQ5vVUE=46xPU1LLJJ2GuYSREWsTY49WbfPV6R0sM3g@mail.gmail.com>

Greetings,

Please don't top-post on these lists.

* Derek Hans (derek.hans@gmail.com) wrote:
> Thanks for the detailed response, super helpful in understanding what's
> happening, in particular understanding the risk of not marking functions as
> leakproof. I'll take a look at the underlying code to understand what's
> involved in getting a function to be leakproof.

Great.

> That said, it does seem like it should be possible and reasonable to
> specify that a user should have access to the table stats so that the query
> planner works as expected. Maybe it comes down to the fact that RLS is
> still a work in progress, and I shouldn't be relying on it unless I'm
> really certain it supports the functionality I need.

PostgreSQL is still very much a work in progress. :)

> I've updated word_similarity_op(text,text) to be leakproof, and
> pg_proc agrees it is. I'm assuming word_similarity_op() is equivalent to
> <%, though I haven't found explicit confirmation. However, using
> word_similarity() instead of <% on a 100k row table, without any RLS
> involved, doesn't make use of the index, while using <% does. Obviously,
> adding the RLS doesn't make that any better. Any idea what might be the
> cause?

Just to be clear, you should be looking at pg_operator (oprcode) to
determine the function that is under the operator that you wish to
change to being leakproof.

Note that the selectivity functions are associated with the operator,
not the function itself.

Thanks,

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (12+ messages)  latest in thread

Message-ID: <20190813230316.GQ16436@tamriel.snowman.net>
Permalink:  ../20190813230316.GQ16436@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20190813230316.GQ16436@tamriel.snowman.net

 · 

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: sfrost@snowman.net, derek.hans@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: GIST/GIN index not used with Row Level Security
  In-Reply-To: <20190813230316.GQ16436@tamriel.snowman.net>
  References: <CAGrP7a2t+JbeuxpQY+RSvNe4fr3+==UmyimwV0GCD+wcrSSb=w@mail.gmail.com> <12552.1565723566@sss.pgh.pa.us> <CAGrP7a3JcEorwM98OGn7s-TZ1os8rubCqeEXLgqeZrvX4LfwvQ@mail.gmail.com> <14241.1565725716@sss.pgh.pa.us> <CAGrP7a3ZZ5MaMi3LLmPy121K_YDYCkinu2gcq8PQzQqpGUuEkQ@mail.gmail.com> <20190813213930.GO16436@tamriel.snowman.net> <CAGrP7a2kQ5vVUE=46xPU1LLJJ2GuYSREWsTY49WbfPV6R0sM3g@mail.gmail.com> <20190813230316.GQ16436@tamriel.snowman.net>

* 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