From: Eric Marsden <eric.marsden@risk-engineering.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: Cache lookup failed for type 34813 (CREATE TYPE AS ENUM + P/B/E insert, processor-specific) / user error
Date: Fri, 21 Jun 2024 18:16:53 +0200
Message-ID: <08e82e11-1018-4c01-b387-b2db5de6b455@risk-engineering.org> (raw)
In-Reply-To: <595887.1718984150@sss.pgh.pa.us>
References: <2dcacb45-81c9-4c38-aa36-70e2dc8df487@risk-engineering.org>
<595887.1718984150@sss.pgh.pa.us>
On 21/06/2024 17:35, Tom Lane wrote:
> Eric Marsden<eric.marsden@risk-engineering.org> writes:
>> I see a PostgreSQL error "cache lookup failed for type 34813" after the
>> following sequence of network requests over a single network connection
>> to PostgreSQL (which is otherwise idle):
>> CREATE TYPE rating AS ENUM('ungood', 'good')
>> CREATE TABLE act(name TEXT, value RATING)
>> INSERT INTO act VALUES('thoughtcrime', 'ungood') -- OK
>> INSERT INTO act VALUES('blackwhite', $1) -- with $1 = "good" / type oid for "rating" / text format
Thanks to very useful discussions on #postgresql (IRC), I have found out
that this is a user error rather than a PostgreSQL bug. My PostgreSQL
network protocol library maintains an oid <-> type-name cache that is
populated at connection startup time. Due to improper cleanup in the
tests, a old value for the type oid was remaining when testing on my own
computer (but not in Docker nor for clean test runs on other machines),
so the PostgreSQL error message is perfectly valid.
I have realized that I need to stop using this oid <-> type-name cache
for types that are not PostgreSQL builtins, because there is no way of
ensuring it's synchronized with the backend values.
Thanks, and apologies for the spurious report,
Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: eric.marsden@risk-engineering.org, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
Subject: Re: Cache lookup failed for type 34813 (CREATE TYPE AS ENUM + P/B/E insert, processor-specific) / user error
In-Reply-To: <08e82e11-1018-4c01-b387-b2db5de6b455@risk-engineering.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox