Re: [GENERAL] cache lookup of relation 165058647 failed

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sean Chittenden <sean@chittenden.org>
Cc: Jan Wieck <JanWieck@Yahoo.com>, PostgreSQL Bugs List <pgsql-bugs@postgresql.org>, Juris Krumins <juriskr@komin.lv>
Date: 2004-05-04T05:55:23Z
Lists: pgsql-bugs, pgsql-general
Sean Chittenden <sean@chittenden.org> writes:
> But, I am suspecting that it's a race condition with the new background 
> writer code.

Why?  Have you demonstrated that the failure does not occur in 7.4?

> psql:test-end2.sql:3: ERROR:  cache lookup failed for relation 398033
> CONTEXT:  SQL query "SELECT  TRUE FROM pg_catalog.pg_class c LEFT JOIN 
> pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname = 
> 'tmptbl'::TEXT AND c.relkind = 'r'::TEXT AND 
> pg_catalog.pg_table_is_visible(c.oid)"

I think that pg_table_is_visible() will inspect the catalogs using
SnapshotNow semantics, while the above query will feed it with OIDs that
were valid under a start-of-query snapshot.  So I'd expect failures in
any recent PG version, if tables are being dynamically created/deleted
by concurrent transactions.

			regards, tom lane