Leakproofness of texteq()/textne()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Stephen Frost <sfrost@snowman.net>
Date: 2019-09-12T15:51:10Z
Lists: pgsql-hackers
Currently, texteq() and textne() are marked leakproof, while sibling operations such as textlt() are not. The argument for that was that those two functions depend only on memcmp() so they can be seen to be safe, whereas it's a whole lot less clear that text_cmp() should be considered leakproof. Of course, the addition of nondeterministic collations has utterly obliterated that argument: it's now possible for texteq() to call text_cmp(), so if the latter is leaky then the former certainly must be considered so as well. Seems like we have two choices: 1. Remove the leakproof marking on texteq()/textne(). This would, unfortunately, be catastrophic for performance in a lot of scenarios where leakproofness matters. 2. Fix text_cmp to actually be leakproof, whereupon we might as well mark all the remaining btree comparison operators leakproof. I think #2 is pretty obviously the superior answer, if we can do it. ISTM we can't ship v12 without dealing with this one way or the other, so I'll go add an open item. Comments? regards, tom lane
Commits
-
Straighten out leakproofness markings on text comparison functions.
- d9110d7e1481 12.0 landed
- c160b8928c77 13.0 landed