pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
To: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Numeric is not leakproof
Date: Wed, 4 Dec 2019 12:28:11 +0300
Message-ID: <d0a7dea1-dd10-e641-7e13-2a73dcc6bd90@postgrespro.ru> (raw)
In-Reply-To: <20191203204311.GU6962@tamriel.snowman.net>
References: <13a01430-672d-c73c-7abe-0b70e9e8aa01@postgrespro.ru>
	<20191203204311.GU6962@tamriel.snowman.net>



On 03.12.2019 23:43, Stephen Frost wrote:
> Greetings,
>
> * Konstantin Knizhnik (k.knizhnik@postgrespro.ru) wrote:
>> Numeric functions are not marked as leakproof in pg_proc.dat
>> It cause unexpected behavior in case of using row-level security:
> The behavior you're getting is *entirely* expected, just to be clear.
> Perhaps unfortunate and not as performant as you were hoping, but
> definitely not unexpected.
>
> As Tom noted downthread, you can't just mark things 'leakproof' because
> you want them to be able to be used in an index- you need to actually
> show that they're leakproof.
>
>> I have not checked all other builtin type.
>> But it seems to me that it may be reasonable to mark ALL builtin functions
>> (described in pg_proc.dat) as leekprof by default.
> Absolutely not without careful verification of each and every one.
> There's nothing that guarantees builtins are leakproof (and indeed,
> there's no shortage of ones that are clearly *not* leakproof today).
>
> I'd love it for someone to go through and fix them all to actually be
> leakproof (or at least all of the ones that might be used with an index)
> but that clearly hasn't been done here.

Ok, I understand that it is not possible just to mark all built-in 
functions as leak proof, but what about
marking as leakproof just comparison functions for the numeric type as I 
proposed in the attached patch?
I have checked that cmp_numerics can not report any errors and so it can 
be considered as leekprof as far as comparison functions for most of 
other builtin types
which are already marked as leakproof.

After applying this patch opr_sanity test is failed (just because list 
of leakproof functions is extended, so expected result for this test 
should also be updated).


-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company






view thread (4+ messages)

Message-ID: <d0a7dea1-dd10-e641-7e13-2a73dcc6bd90@postgrespro.ru>
Permalink:  ../d0a7dea1-dd10-e641-7e13-2a73dcc6bd90@postgrespro.ru/
Also on:    postgresql.org/message-id/d0a7dea1-dd10-e641-7e13-2a73dcc6bd90@postgrespro.ru

 · 

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-bugs@postgresql.org
  Cc: k.knizhnik@postgrespro.ru, sfrost@snowman.net
  Subject: Re: Numeric is not leakproof
  In-Reply-To: <d0a7dea1-dd10-e641-7e13-2a73dcc6bd90@postgrespro.ru>
  References: <13a01430-672d-c73c-7abe-0b70e9e8aa01@postgrespro.ru> <20191203204311.GU6962@tamriel.snowman.net> <d0a7dea1-dd10-e641-7e13-2a73dcc6bd90@postgrespro.ru>

* 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