On Thu, May 13, 2021 at 12:01:22PM -0500, Justin Pryzby wrote:
> postgres=# select amvalidate(123);
> ERROR: cache lookup failed for operator class 123
> The usual expectation is that sql callable functions should return null rather
> than hitting elog().
On Thu, May 13, 2021 at 2:22 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Meh. I'm not convinced that that position ought to apply to amvalidate.
On Thu, May 13, 2021 at 04:12:10PM -0400, Robert Haas wrote:
> I am still of the opinion that we ought to apply it across the board,
> for consistency. It makes it easier for humans to know which problems
> are known to be reachable and which are thought to be can't-happen and
> thus bugs. If we fix cases like this to return a real error code, then
> anything that comes up as XX000 is likely to be a real bug, whereas if
> we don't, the things that we're not concerned about have to be
> filtered out by some other method, probably involving a human being.
> If the filter that human being has to apply further involves reading
> Tom Lane's mind and knowing what he will think about a particular
> report, or alternatively asking him, it just makes complicated
> something that we could have made simple.
FWIW, here are some other cases from sqlsmith which hit elog()/XX000:
postgres=# select unknownin('');
ERROR: failed to find conversion function from unknown to text
postgres=# \errverbose
ERROR: XX000: failed to find conversion function from unknown to text
LOCATION: coerce_type, parse_coerce.c:542
postgres=# SELECT pg_catalog.interval( '12 seconds'::interval ,3);
ERROR: unrecognized interval typmod: 3
postgres=# SELECT pg_describe_object(1,0,1);
ERROR: invalid non-zero objectSubId for object class 1
postgres=# SELECT pg_read_file( repeat('a',333));
ERROR: could not open file
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
forreading: File name too long
--
Justin