Re: amvalidate(): cache lookup failed for operator class 123

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: amvalidate(): cache lookup failed for operator class 123
Date: 2023-02-13 13:50:53
Message-ID: 20230213135053.GZ1653@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)sss(dot)pgh(dot)pa(dot)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" for reading: File name too long

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema 2023-02-13 14:02:39 Re: run pgindent on a regular basis / scripted manner
Previous Message Andrew Dunstan 2023-02-13 13:27:37 Re: run pgindent on a regular basis / scripted manner