Re: GIST/GIN index not used with Row Level Security - Mailing list pgsql-general

From Derek Hans
Subject Re: GIST/GIN index not used with Row Level Security
Date
Msg-id CAGrP7a3ZZ5MaMi3LLmPy121K_YDYCkinu2gcq8PQzQqpGUuEkQ@mail.gmail.com
Whole thread Raw
In response to Re: GIST/GIN index not used with Row Level Security  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: GIST/GIN index not used with Row Level Security  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: GIST/GIN index not used with Row Level Security  (Stephen Frost <sfrost@snowman.net>)
List pgsql-general
Thanks for the pointer for marking functions as leakproof, I was unaware of that whole concept. 

Unfortunately only "alter function" supports "leakproof" - "alter operator" does not. Is there a function-equivalent for marking operators as leakproof? Is there any documentation for which operators/functions are leakproof?

In my particular case, RLS is still useful even if operators are leaky as I control the application code and therefore can ensure leaky errors are handled. If it's possible to disable all checking for "leakproof", that would work for me. 

> If that's not possible, it sounds like it
> effectively blocks the use of GIN/GIST indexes when RLS is in use.

There's a whole lot of daylight between "it doesn't pick an indexscan in
this one example" and "it effectively blocks the use of GIN/GIST".

True indeed :). Would you have a working example of using a GIN/GIST index with RLS? All the attempts I've made have ended in seq scans. In practice, I'm looking to implement fuzzy search using trigrams, so % and %> operators are what matter to me. ~~ also happens to fail. Should I expect to be able to use any of these with RLS, large amounts of data and reasonable performance? 

Your description of leakproof (and the documentation I've found) makes it sound like I'm not just hitting an isolated problem, but a general problem with RLS that represents a substantial limitation and is likely worth documenting. 
 
--

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: GIST/GIN index not used with Row Level Security
Next
From: Tom Lane
Date:
Subject: Re: GIST/GIN index not used with Row Level Security