pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Christophe Pettus <xof@thebuild.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: lower() and unaccent() not leakproof
Date: Thu, 26 Aug 2021 15:43:10 -0400
Message-ID: <673096.1630006990@sss.pgh.pa.us> (raw)
In-Reply-To: <7eb0e72c-d638-a223-858c-24ce29f1f2e8@enterprisedb.com>
References: <02BDFCCF-BDBB-4658-9717-4D95F9A91561@thebuild.com>
	<CAKFQuwYtO2ifxXzqL7BTgyjZFfUGcv=gyH9Gu+LkQQ163ib_=Q@mail.gmail.com>
	<b6169dcd-80fd-d0f2-af3f-7d902f06d052@enterprisedb.com>
	<648381.1629986401@sss.pgh.pa.us>
	<7eb0e72c-d638-a223-858c-24ce29f1f2e8@enterprisedb.com>

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> I think the complexity of the implementation of upper() and lower() is 
> on the same order as bttextcmp() and similar, so it wouldn't be totally 
> out of scope.

True.  But you'll recall that the decision to mark bttextcmp() and
cohorts as leakproof was not made without fear.  IMV, that decision
did not rest simply on code review but on two arguments about why
we should take the risk:

* The query-optimization usefulness of having those be leakproof
is extremely high.

* btree comparison functions should really not have any user-reachable
failure modes (which comes close to being the definition of leakproof).
If one did, that would mean there were legal values of the type that
couldn't be put into a btree index.

Maybe similar arguments can be made about upper/lower, but I think
it's a far weaker case.  As for unaccent, the fact that it relies
on user-controllable definitions seems to me to make it almost
certainly unsafe to be leakproof.

			regards, tom lane





view thread (9+ messages)

Message-ID: <673096.1630006990@sss.pgh.pa.us>
Permalink:  ../673096.1630006990@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/673096.1630006990@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, peter.eisentraut@enterprisedb.com, david.g.johnston@gmail.com, xof@thebuild.com
  Subject: Re: lower() and unaccent() not leakproof
  In-Reply-To: <673096.1630006990@sss.pgh.pa.us>
  References: <02BDFCCF-BDBB-4658-9717-4D95F9A91561@thebuild.com> <CAKFQuwYtO2ifxXzqL7BTgyjZFfUGcv=gyH9Gu+LkQQ163ib_=Q@mail.gmail.com> <b6169dcd-80fd-d0f2-af3f-7d902f06d052@enterprisedb.com> <648381.1629986401@sss.pgh.pa.us> <7eb0e72c-d638-a223-858c-24ce29f1f2e8@enterprisedb.com> <673096.1630006990@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