From: | Eric Marsden <eric(dot)marsden(at)risk-engineering(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Cache lookup failed for type 34813 (CREATE TYPE AS ENUM + P/B/E insert, processor-specific) / user error |
Date: | 2024-06-21 16:16:53 |
Message-ID: | 08e82e11-1018-4c01-b387-b2db5de6b455@risk-engineering.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 21/06/2024 17:35, Tom Lane wrote:
> Eric Marsden<eric(dot)marsden(at)risk-engineering(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2024-06-24 03:54:46 | Re: Potential data loss due to race condition during logical replication slot creation |
Previous Message | Tom Lane | 2024-06-21 15:35:50 | Re: Cache lookup failed for type 34813 (CREATE TYPE AS ENUM + P/B/E insert, processor-specific) |