cache lookup failed for statistics object 123

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: cache lookup failed for statistics object 123
Date: 2021-05-05 21:09:47
Message-ID: 20210505210947.GA27406@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Per sqlsmith.

postgres=# SELECT pg_get_statisticsobjdef_expressions(123);
ERROR: cache lookup failed for statistics object 123
postgres=# \errverbose
ERROR: XX000: cache lookup failed for statistics object 123
LOCATION: pg_get_statisticsobjdef_expressions, ruleutils.c:1762

The expectation is that sql callable functions should return null rather than
hitting elog().

In the 003 patch, I wonder if this part should be updated, too:

| ... which can greatly improve query plans that use the expression index.

It can improve queries even that don't use the index, right ?
Say, if a query has f(x) = 11, and the MCV list for the expression shows that
50% of the table has f(x)=11, then the query might decide to *not* use an index
scan.

--
Justin

Attachment Content-Type Size
0001-Return-NULL-rather-than-elog-ERROR-for-sql-callable-.patch text/x-diff 1.0 KB
0002-Comment-typos-extended-stats-a4d75c86b-and-518442c7f.patch text/x-diff 1.6 KB
0003-Mention-statistics-objects.patch text/x-diff 1003 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-05-05 21:12:18 Re: Bogus collation version recording in recordMultipleDependencies
Previous Message Andrew Dunstan 2021-05-05 20:58:08 Re: Bogus collation version recording in recordMultipleDependencies