Internal error with types changes and prepared statements - Mailing list pgsql-bugs

From Daniele Varrazzo
Subject Internal error with types changes and prepared statements
Date
Msg-id CA+mi_8YAGf9qibDFTRNKgaTwaBa1OUcteKqLAxfMmKFbo3GHZg@mail.gmail.com
Whole thread Raw
Responses Re: Internal error with types changes and prepared statements
List pgsql-bugs
From https://github.com/sqlalchemy/sqlalchemy/issues/6842#issuecomment-925131836

The issue can be reproduced in psql with the following commands
(tested with PostgreSQL 12.8):

BEGIN;
CREATE TYPE an_enum AS ENUM ('foo', 'bar', 'baz');
CREATE TABLE foo(id integer, bar an_enum[]);
PREPARE stmt (an_enum[]) AS INSERT INTO foo (bar) VALUES ($1);
EXECUTE stmt ('{foo}');
ROLLBACK;

BEGIN;
CREATE TYPE an_enum AS ENUM ('foo', 'bar', 'baz');
CREATE TABLE foo(id integer, bar an_enum[]);
EXECUTE stmt ('{foo}');
ERROR:  cache lookup failed for type 8072147

\errverbose
ERROR:  XX000: cache lookup failed for type 8072147
LOCATION:  getBaseTypeAndTypmod, lsyscache.c:2355

Note: the issue is caused by Psycopg 3 use of prepared statements. Do
you suggest discarding prepared statements on a rollback on the
connection? I haven't seen documentation describing the interaction
between transactions and prepared statements.

Cheers

-- Daniele



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17200: PostgreSQL-Support Profile Guide Optimization(Clang/GCC)?
Next
From: Tom Lane
Date:
Subject: Re: Internal error with types changes and prepared statements