Re: Making the ENUM operators LEAKPROOF

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Making the ENUM operators LEAKPROOF
Date: 2026-07-01 22:33:45
Message-ID: 3652798.1782945225@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> This is an attempt to get the operators from the "enum_ops" operator
> class LEAKPROOF.

I think we should reject this idea. Our standard for marking
functions leakproof has always included a requirement that the amount
of code involved be small enough that one can immediately confirm that
there is no information leak. I don't think that enum_cmp() can meet
that standard; the length of your argument already proves the point.
The issue here is not really "can I convince myself that it's safe
today?". It's more about "am I willing to bet that no future code
change is going to unintentionally break the property?". The more
code involved, the riskier that bet.

I know that you are going to say "but text_cmp covers a lot of
ground, including code (in libc or ICU) that isn't even ours".
To my mind, we made an exception for text_cmp because the performance
consequences of not making it leakproof were unacceptable.
I do not think enum_cmp() can clear that bar either.

FWIW, I do agree that marking enum_eq leakproof is safe. How
many of the use-cases you are worried about would be satisfied
with that?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-07-01 22:57:51 Re: postgres_fdw: fix cumulative stats after imported foreign-table stats
Previous Message Tom Lane 2026-07-01 22:21:15 Re: Make transformAExprIn() return a flattened bool expression directly