Re: Internal error codes triggered by regression tests and user queries, take 2
Re: Internal error codes triggered by regression tests and user queries, take 2
On Fri, Aug 28, 2026 at 03:00:00PM +0300, Alexander Lakhin wrote: > I agree. The fact that the internal error is reached from a legal SQL-level > function doesn't make all other ways to reach it expected/normal. This is > one issue with this proposal. Not all of them are. See below for details. Looking (finally) at the list you have sent in your patch, I can get on board for: - getObjectDescription(), can be queried with a function officially documented. - ATPrepAddPrimaryKey(). This one is a bug to me, reachable with SQL. - transformColumnDefinition(). Also a bug to me. - pg_get_shmem_allocations_numa. Bug. - acldefault() is documented. Seems worth fixing for correctness, documented function. - AdjustIntervalForTypmod(). Documented feature. - The pl_gram.y one looks like a defect to me by not assigning an error code. But not for these: - relation_open(), incorrect internal state from the caller. - try_relation_open(), incorrect internal state from the caller. coerce_type(), also an internal state. unknownin() is also an - "internal" input, non-documented SQL function. - check_float8_array(). Your case involves float8_regr_intercept(), which is a final aggregate function. It is not documented, and should never really be called directly. - get_range_io_data(). Cannot get excited about this one, either, as your case involves the direct call of an input function. Can this happen with more patterns? - test_pglz_decompress() is test code, no need to worry about it. > The other one is the unclear definition of internal/XX000 errors in > principle. As far as I can see, it varies from "all the errors that have > no specific code assigned" to "critical errors, similar to failed asserts" > (and probably a substitute for asserts in production). And as Andres (and > I too) find it useful to search for XX000 in production logs, it means > they are interpreted per the second definition. In this case, it makes > sense to define missing codes for cases which are not worth paying > attention to in production, e.g. "#print_strict_params XXX". Moreover, if > the second definition (XX000 error ~ failed assert) is going to be > accepted, it seems sensible to have no such errors produced during > regression tests (like no assertion failures). I think that I would draw a line depending on the documentation. If a function is documented as usable, or callable through a view, it sounds fair to me to assume that a user gets an error code that fits with the incorrect behavior provided as input argument. Input function for types, test code, direct function calls to embedded facilities like aggregates, or anything like that, not documented, is not worth bothering. The fact that none of them is documented is an argument good enough for me to state that we don't really expect users to use these this way. The important piece to keep in mind is that non-internal ereport() calls mean translation. There is no point in providing translation for states that we expect users to never see in the field, and the docs define what we make user-visible. > I would elaborate on these when the consensus on the definition is reached. > > [1] https://www.postgresql.org/message-id/flat/ba76c6bc-f03f-4285-bf16-47759cfcab9e%40eisentraut.org > [2] https://www.postgresql.org/message-id/Zic_GNgos5sMxKoa%40paquier.xyz Among the 13 patterns you have sent, 7 of them make sense to me as being reachable through documented patterns, 6 are not. As far as I can see, Andres seems to me roughly among the same line, except for get_range_io_data() that I disagree with as not reachable by normal (aka documented) means based on the information provided. Among the 7 patterns worth fixing, I'd suggest either improvements to the error messages, or even better: check if we could reuse any of the existing error messages already translated. -- Michael
Re: Internal error codes triggered by regression tests and user queries, take 2
On Sat, Sep 12, 2026 at 02:00:00PM +0300, Alexander Lakhin wrote: > Please look at the attached v3-Define-...patch, where I think I addressed > all of your comments. The ACL bits were slightly puzzling because it's the first time I see this pattern in the code (following Tom's comment upthread also in tsvector), and I indeed get much better error messages: =# SELECT acldefault(E'\x80'::"char", 0); ERROR: 22021: invalid byte sequence for encoding "UTF8": 0x80 =# SELECT acldefault(chr(1)::"char", 10); ERROR: 22023: unrecognized object type abbreviation: "\001" The second query just showed nothing originally. For the typmods, %d is a better choice to me as the input is an integer. As a whole, that looks OK, so applied on HEAD. I did not look at 0002. -- Michael
Re: Internal error codes triggered by regression tests and user queries, take 2
Hello Michael and Tom,
22.09.2026 13:49, Michael Paquier wrote:
22.09.2026 13:49, Michael Paquier wrote:
As a whole, that looks OK, so applied on HEAD. I did not look at 0002.
Let me share the following set of other internal errors:
1)
CREATE TABLE t AS SELECT ''::text a;
CREATE INDEX brinidx ON t USING brin
(a text_bloom_ops(n_distinct_per_range = -1.0));
ERROR: XX000: the bloom filter is too large (44629 > 8144)
LOCATION: bloom_init, brin_bloom.c:
-> ERRCODE_PROGRAM_LIMIT_EXCEEDED
2)
SELECT pg_identify_object_as_address('1'::regclass, 1, 1);
ERROR: XX000: unsupported object class: 1
LOCATION: getObjectTypeDescription, objectaddress.c:4731
-> ERRCODE_INVALID_PARAMETER_VALUE
3)
SELECT pg_get_acl('1'::regclass, 1, 0);
ERROR: XX000: unrecognized class ID: 1
LOCATION: get_object_property_data, objectaddress.c:2821
-> ERRCODE_INVALID_PARAMETER_VALUE
4)
SELECT jsonb_to_tsvector('{}', '[{}]'::jsonb);
ERROR: XX000: unexpected end of flag array
LOCATION: parse_jsonb_index_flags, jsonfuncs.c:5614
-> ERRCODE_INVALID_PARAMETER_VALUE
5)
CREATE PROCEDURE p(INOUT a integer) LANGUAGE sql
AS 'SELECT 1 WHERE false;';
CALL p(1);
ERROR: XX000: procedure returned null record
LOCATION: ExecuteCallStmt, functioncmds.c:2351
-> ERRCODE_INVALID_OBJECT_DEFINITION
6)
CREATE EXTENSION dblink;
CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS
$f$ SELECT $$dbname='$$||current_database()||$$' port=$$||current_setting('port'); $f$;
SELECT dblink_connect('myconn',connection_parameters());
SELECT * FROM dblink_send_query('myconn', 'SELECT 1');
SELECT * FROM dblink('myconn', 'SELECT 2') AS t(i int);
ERROR: XX000: could not send query: another command is already in progress
LOCATION: storeQueryResult, dblink.c:1103
-> ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
Please look at the attached patch which defines these error codes.
Best regards,
Alexander
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Kirill Reshke <reshkekirill@gmail.com>
Дата:
On Sat, 17 Oct 2026 at 16:00, Alexander Lakhin wrote:
>
> Hello Michael and Tom,
>
> 22.09.2026 13:49, Michael Paquier wrote:
>
> As a whole, that looks OK, so applied on HEAD. I did not look at
> 0002.
>
>
> Let me share the following set of other internal errors:
> 1)
> CREATE TABLE t AS SELECT ''::text a;
> CREATE INDEX brinidx ON t USING brin
> (a text_bloom_ops(n_distinct_per_range = -1.0));
>
> ERROR: XX000: the bloom filter is too large (44629 > 8144)
> LOCATION: bloom_init, brin_bloom.c:
> -> ERRCODE_PROGRAM_LIMIT_EXCEEDED
>
> 2)
> SELECT pg_identify_object_as_address('1'::regclass, 1, 1);
>
> ERROR: XX000: unsupported object class: 1
> LOCATION: getObjectTypeDescription, objectaddress.c:4731
> -> ERRCODE_INVALID_PARAMETER_VALUE
>
> 3)
> SELECT pg_get_acl('1'::regclass, 1, 0);
>
> ERROR: XX000: unrecognized class ID: 1
> LOCATION: get_object_property_data, objectaddress.c:2821
> -> ERRCODE_INVALID_PARAMETER_VALUE
>
> 4)
> SELECT jsonb_to_tsvector('{}', '[{}]'::jsonb);
>
> ERROR: XX000: unexpected end of flag array
> LOCATION: parse_jsonb_index_flags, jsonfuncs.c:5614
> -> ERRCODE_INVALID_PARAMETER_VALUE
>
> 5)
> CREATE PROCEDURE p(INOUT a integer) LANGUAGE sql
> AS 'SELECT 1 WHERE false;';
> CALL p(1);
>
> ERROR: XX000: procedure returned null record
> LOCATION: ExecuteCallStmt, functioncmds.c:2351
> -> ERRCODE_INVALID_OBJECT_DEFINITION
>
> 6)
> CREATE EXTENSION dblink;
> CREATE FUNCTION connection_parameters() RETURNS text LANGUAGE SQL AS
> $f$ SELECT $$dbname='$$||current_database()||$$' port=$$||current_setting('port'); $f$;
> SELECT dblink_connect('myconn',connection_parameters());
> SELECT * FROM dblink_send_query('myconn', 'SELECT 1');
> SELECT * FROM dblink('myconn', 'SELECT 2') AS t(i int);
>
> ERROR: XX000: could not send query: another command is already in progress
> LOCATION: storeQueryResult, dblink.c:1103
> -> ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
>
> Please look at the attached patch which defines these error codes.
>
> Best regards,
> Alexander
Hi
I run some fuzzing after you reply in [0]. There are results .
1)
CREATE EXTENSION intarray;
SELECT querytree('1'::query_int);
ERROR: XX000: querytree is no longer implemented
LOCATION: querytree, _int_bool.c:713
-> ERRCODE_FEATURE_NOT_SUPPORTED
2)
CREATE EXTENSION ltree;
CREATE TEMP TABLE t (v ltree);
COPY (SELECT '\x0002036162'::bytea) TO '/tmp/g.bin' BINARY;
COPY t FROM '/tmp/g.bin' BINARY;
ERROR: XX000: unsupported ltree version number 3
LOCATION: ltree_recv, ltree_io.c:239
-> ERRCODE_INVALID_BINARY_REPRESENTATION
The same class in lquery_recv/ltxtq_recv, and in core:
jsonpath_recv/jsonb_recv ("unsupported ... version number"),
tsvector_recv, tsquery_recv:
3)
CREATE TEMP TABLE t (v tsquery);
COPY (SELECT '\x0000000105'::bytea) TO '/tmp/g.bin' BINARY;
COPY t FROM '/tmp/g.bin' BINARY;
ERROR: XX000: unrecognized tsquery node type: 5
-> ERRCODE_INVALID_BINARY_REPRESENTATION
4)
CREATE EXTENSION dblink;
CREATE FUNCTION g(text,text) RETURNS setof int
AS 'dblink','dblink_record' LANGUAGE C;
SELECT dblink_connect('c', 'dbname=test');
SELECT * FROM g('c', 'SELECT 1');
ERROR: XX000: return type must be a row type
LOCATION: materializeResult, dblink.c:915
-> ERRCODDE_DATATYPE_MISMATCH
(together with the "wrong number of arguments" siblings in
dblink_send_query/dblink_record_internal/dblink_exec:
ERRCODE_INVALID_PARAMETER_VALUE)
5)
ALTER COLLATION "default" REFRESH VERSION;
ERROR: XX000: cannot refresh version of default collation
LOCATION: collationcmds.c:445
-> ERRCODE_FEATURE_NOT_SUPPORTED
same as reported in neighbor thread
6)
CREATE OPERATOR FAMILY noeq_fam USING btree;
CREATE FUNCTION noeq_cmp(int,int) RETURNS int AS 'SELECT 0'
LANGUAGE sql IMMUTABLE;
CREATE OPERATOR CLASS noeq_ops FOR TYPE int
USING btree FAMILY noeq_fam AS FUNCTION 1 noeq_cmp(int,int);
CREATE MATERIALIZED VIEW mv AS SELECT 1 AS a;
CREATE UNIQUE INDEX ON mv (a noeq_ops);
REFRESH MATERIALIZED VIEW CONCURRENTLY mv;
ERROR: XX000: missing equality operator for (23,23) in opfamily 16430
LOCATION: refresh_by_diff, matview.c:771
-> ERRCODE_FEATURE_NOT_SUPPORTED
7)
CREATE EXTENSION pg_buffercache;
SELECT * FROM pg_buffercache_evict(0);
ERROR: XX000: bad buffer ID: 0
-> ERRCODE_INVALID_PARAMETER_VALUE
SELECT * FROM pg_buffercache_pages() AS (a int);
ERROR: XX000: incorrect number of output arguments
-> ERRCODE_DATATYPE_MISMATCH
8)
CREATE EXTENSION pgcrypto;
SELECT crypt('secret', '$5$abc$6$xyz');
ERROR: XX000: bogus magic byte found in salt string
LOCATION: crypt-sha.c:309
-> ERRCODE_INVALID_PARAMETER_VALUE
9)
CREATE EXTENSION lo;
SELECT lo_manage();
ERROR: XX000: lo_manage() must be fired by a trigger manager
LOCATION: lo.c:39
-> ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED
(argument-count/column cases: ERRCODE_INVALID_PARAMETER_VALUE,
nonexistent column: ERRCODE_UNDEFINED_COLUMN)
10)
CREATE EXTENSION autoinc;
SELECT autoinc();
ERROR: XX000: autoinc (t): must be fired by row: statement-level trigger
-> ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED
11)
SELECT tsvector_update_trigger();
ERROR: XX000: tsvector_update_trigger: not fired by trigger manager
LOCATION: tsvector_op.c:2763
-> ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED
12) test modules, when installed:
SELECT * FROM test_predtest('SELECT 1');
ERROR: XX000: query must yield two boolean columns
-> ERRCODE_DATATYPE_MISMATCH
13) one case where the XX000 leaks from a missing plan-cache
dependency rather than a bare errcode:
CREATE TEXT SEARCH CONFIGURATION cfg (copy=simple);
PREPARE p(text) AS SELECT to_tsquery('cfg', $1);
EXECUTE p('a & b');
DROP TEXT SEARCH CONFIGURATION cfg CASCADE;
EXECUTE p('a & b');
ERROR: XX000: cache lookup failed for text search configuration 16409
For this one I prepared simple fix
diff --git a/src/backend/optimizer/plan/setrefs.c
b/src/backend/optimizer/plan/setrefs.c
index af78892fafc..c7b8d220fb0 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -2169,6 +2169,21 @@ fix_expr_common(PlannerInfo *root, Node *node)
root->glob->relationOids =
lappend_oid(root->glob->relationOids,
DatumGetObjectId(con->constvalue));
+
+ /* Check for regconfig reference: record an inval-item dependency
+ * so that the plan is revalidated if the text search configuration
+ * is dropped.
+ */
+ if (con->consttype == REGCONFIGOID && !con->constisnull)
+ {
+ PlanInvalItem *inval_item = makeNode(PlanInvalItem);
+
+ inval_item->cacheId = TSCONFIGOID;
+ inval_item->hashValue = GetSysCacheHashValue1(TSCONFIGOID,
+ con->constvalue);
+ root->glob->invalItems =
+ lappend(root->glob->invalItems, inval_item);
+ }
}
else if (IsA(node, GroupingFunc))
{
diff --git a/src/backend/utils/cache/plancache.c
b/src/backend/utils/cache/plancache.c
index a1b406cee29..f641efe2a73 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -156,6 +156,7 @@ InitPlanCache(void)
CacheRegisterRelcacheCallback(PlanCacheRelCallback, (Datum) 0);
CacheRegisterSyscacheCallback(PROCOID, PlanCacheObjectCallback, (Datum) 0);
CacheRegisterSyscacheCallback(TYPEOID, PlanCacheObjectCallback, (Datum) 0);
+ CacheRegisterSyscacheCallback(TSCONFIGOID, PlanCacheSysCallback, (Datum) 0);
CacheRegisterSyscacheCallback(NAMESPACEOID, PlanCacheSysCallback, (Datum) 0);
CacheRegisterSyscacheCallback(OPEROID, PlanCacheSysCallback, (Datum) 0);
CacheRegisterSyscacheCallback(AMOPOPID, PlanCacheSysCallback, (Datum) 0);
I didn't check the novelty of this reports.
[0] https://www.postgresql.org/message-id/c3025db3-3b9d-45dd-af61-845839d73399%40gmail.com
--
Best regards,
Kirill Reshke
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Alexander Lakhin <exclusion@gmail.com>
Дата:
Hello Kirill, 01.11.2026 12:01, Kirill Reshke wrote: > I run some fuzzing after you reply in [0]. There are results . Thank you for working on this! I encountered several of these cases before, but didn't report them, e.g. operator-related because of [1]. But yes, contrib/ has a lot of user-reachable elog(ERRORs)... Probably the list needs filtering, according to the above discussion. [1] https://www.postgresql.org/message-id/Zo4ROR9mgy8bowMo%40paquier.xyz Best regards, Alexander
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Kirill Reshke <reshkekirill@gmail.com>
Дата:
On Sun, 1 Nov 2026 at 16:00, Alexander Lakhin wrote: > > Hello Kirill, > > 01.11.2026 12:01, Kirill Reshke wrote: > > I run some fuzzing after you reply in [0]. There are results . > > Thank you for working on this! I encountered several of these cases before, > but didn't report them, e.g. operator-related because of [1]. But yes, > contrib/ has a lot of user-reachable elog(ERRORs)... > > Probably the list needs filtering, according to the above discussion. > > [1] https://www.postgresql.org/message-id/Zo4ROR9mgy8bowMo%40paquier.xyz > > Best regards, > Alexander Yeah, I had a hunch that most of this wouldn't be fixed. But reading the thread from your link, I put it in simple rule : code area is little maintained -> no care, otherwise all sql-reachable errors should not be XX000. Filtering my report with this rule, I think we need to take care of 4-7, 11, 13 -- Best regards, Kirill Reshke
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Andres Freund <andres@anarazel.de>
Дата:
On 2026-11-01 17:13:26 +0500, Kirill Reshke wrote: > On Sun, 1 Nov 2026 at 16:00, Alexander Lakhin wrote: > > 01.11.2026 12:01, Kirill Reshke wrote: > > > I run some fuzzing after you reply in [0]. There are results . > > > > Thank you for working on this! I encountered several of these cases before, > > but didn't report them, e.g. operator-related because of [1]. But yes, > > contrib/ has a lot of user-reachable elog(ERRORs)... > > > > Probably the list needs filtering, according to the above discussion. > > > > [1] https://www.postgresql.org/message-id/Zo4ROR9mgy8bowMo%40paquier.xyz > > > > Best regards, > > Alexander > > Yeah, I had a hunch that most of this wouldn't be fixed. But reading > the thread from your link, I put it in simple rule : code area is > little maintained -> no care, otherwise all sql-reachable errors > should not be XX000. > > Filtering my report with this rule, I think we need to take care of 4-7, 11, 13 We're quite busy, being flooded with bug reports and ginormous patches. Why are we trying to find even more work by searching for inconsequential stuff like this? I really don't get it. Like, you wrote a fuzzer to search for these. WHY?
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Andres Freund writes: > On 2026-11-01 17:13:26 +0500, Kirill Reshke wrote: >> Filtering my report with this rule, I think we need to take care of 4-7, 11, 13 > We're quite busy, being flooded with bug reports and ginormous patches. Why > are we trying to find even more work by searching for inconsequential stuff > like this? I really don't get it. Like, you wrote a fuzzer to search for > these. WHY? The reason was mentioned at the top of the thread: some people monitor their logs for XX000 errors. I agree that we can't afford to spend a lot of effort on this, but fixing easily-reached cases seems like a reasonable thing to do, IMO. regards, tom lane
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Andres Freund <andres@anarazel.de>
Дата:
Hi, On 2026-11-01 12:09:37 -0500, Tom Lane wrote: > Andres Freund writes: > > On 2026-11-01 17:13:26 +0500, Kirill Reshke wrote: > >> Filtering my report with this rule, I think we need to take care of 4-7, 11, 13 > > > We're quite busy, being flooded with bug reports and ginormous patches. Why > > are we trying to find even more work by searching for inconsequential stuff > > like this? I really don't get it. Like, you wrote a fuzzer to search for > > these. WHY? > > The reason was mentioned at the top of the thread: some people monitor > their logs for XX000 errors. I agree that we should fix XX000s that can appear in logs in realistic ways. But: > I agree that we can't afford to spend a lot of effort on this, but fixing > easily-reached cases seems like a reasonable thing to do, IMO. I guess I just don't think stuff that needs to be found via a fuzzer and requires e.g. hand-making outdated recv input for ltree, or calling deprecated trigger functions (autoinc) outside of triggers are that. Greetings, Andres Freund
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Kirill Reshke <reshkekirill@gmail.com>
Дата:
On Mon, 2 Nov 2026 at 21:48, Andres Freund wrote: > > Hi, Hi! > On 2026-11-01 12:09:37 -0500, Tom Lane wrote: > > Andres Freund writes: > > > On 2026-11-01 17:13:26 +0500, Kirill Reshke wrote: > > >> Filtering my report with this rule, I think we need to take care of 4-7, 11, 13 > > > > > We're quite busy, being flooded with bug reports and ginormous patches. Why > > > are we trying to find even more work by searching for inconsequential stuff > > > like this? I really don't get it. Like, you wrote a fuzzer to search for > > > these. WHY? > > > > The reason was mentioned at the top of the thread: some people monitor > > their logs for XX000 errors. > > I agree that we should fix XX000s that can appear in logs in realistic > ways. Okay. The thing started with my thread [0] where I have reported an error which I encountered myself (we have a set of private patches about locales). > But: > > > I agree that we can't afford to spend a lot of effort on this, but fixing > > easily-reached cases seems like a reasonable thing to do, IMO. > > I guess I just don't think stuff that needs to be found via a fuzzer and > requires e.g. hand-making outdated recv input for ltree, or calling deprecated > trigger functions (autoinc) outside of triggers are that. OK, I can agree all error are not-likely-sql-reachable, expect case 13 from my report, which is a real server bug in catcache. > Greetings, > > Andres Freund [0] https://www.postgresql.org/message-id/CALdSSPhHy0HeptBdEhaetg%2BabhG_qjRgMb0BB38%2B7JezC4jnzA%40mail.gmail.com -- Best regards, Kirill Reshke
Re: Internal error codes triggered by regression tests and user queries, take 2
От:
Kirill Reshke <reshkekirill@gmail.com>
Дата:
On Mon, 2 Nov 2026 at 22:44, Kirill Reshke wrote: > > On Mon, 2 Nov 2026 at 21:48, Andres Freund wrote: > > > > Hi, > > Hi! > > > On 2026-11-01 12:09:37 -0500, Tom Lane wrote: > > > Andres Freund writes: > > > > On 2026-11-01 17:13:26 +0500, Kirill Reshke wrote: > > > >> Filtering my report with this rule, I think we need to take care of 4-7, 11, 13 > > > > > > > We're quite busy, being flooded with bug reports and ginormous patches. Why > > > > are we trying to find even more work by searching for inconsequential stuff > > > > like this? I really don't get it. Like, you wrote a fuzzer to search for > > > > these. WHY? > > > > > > The reason was mentioned at the top of the thread: some people monitor > > > their logs for XX000 errors. > > > > I agree that we should fix XX000s that can appear in logs in realistic > > ways. > > Okay. The thing started with my thread [0] where I have reported an > error which I encountered myself (we have a set of private patches > about locales). > > > But: > > > > > I agree that we can't afford to spend a lot of effort on this, but fixing > > > easily-reached cases seems like a reasonable thing to do, IMO. > > > > I guess I just don't think stuff that needs to be found via a fuzzer and > > requires e.g. hand-making outdated recv input for ltree, or calling deprecated > > trigger functions (autoinc) outside of triggers are that. > > OK, I can agree all error are not-likely-sql-reachable, expect case 13 > from my report, which is a real server bug in catcache. > > > Greetings, > > > > Andres Freund > > > > [0] https://www.postgresql.org/message-id/CALdSSPhHy0HeptBdEhaetg%2BabhG_qjRgMb0BB38%2B7JezC4jnzA%40mail.gmail.com > > -- > Best regards, > Kirill Reshke Another case begin; create type tt AS (a int, b int); prepare x as SELECT (i, 1)::tt FROM generate_series(1,1) i; rollback ; execute x; --- ERROR: cache lookup failed for type 16487 found by looking into https://git.postgresql.org/cgit/postgresql.git/commit/?id=0b0f5c5af11b868c15ae2f80010e351f04a6b2e5 -- Best regards, Kirill Reshke
Re: Internal error codes triggered by regression tests and user queries, take 2
On Thu, 12 Nov 2026 at 15:29, Kirill Reshke wrote: > > > Another case > > begin; > create type tt AS (a int, b int); > prepare x as SELECT (i, 1)::tt FROM generate_series(1,1) i; > rollback ; > execute x; > --- ERROR: cache lookup failed for type 16487 > > found by looking into > https://git.postgresql.org/cgit/postgresql.git/commit/?id=0b0f5c5af11b868c15ae2f80010e351f04a6b2e5 Looks like typed constants/row expressions reference a user-def type without plan invalidation machinery. Attached uses record_plan_type_dependency to fix that -- Best regards, Kirill Reshke