Apparent race in information_schema.tables - Mailing list pgsql-general

From Florian Weimer
Subject Apparent race in information_schema.tables
Date
Msg-id 82tz3rli14.fsf@mid.bfk.de
Whole thread Raw
Responses Re: Apparent race in information_schema.tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
This query:

SELECT 1 FROM information_schema.tables WHERE table_schema = $1 AND table_name = $2;

fails sporadically with the error "relation with OID <number> does not
exist".  The query is run by a non-superuser, and the table/schema
combination exists in the database.  The query may have been PREPAREd
(it's submitted using DBD::Pg with the default flags)---I would have
to turn on logging to discover this, and I'm somewhat reluctant to do
so.

I guess the OID refers to a temporary table because I can't find it in
pg_class, and the cause is a race between listing the tables and
applying the permission checks to them (which I don't need anyway, I
think) because tables in the system catalog are not subject to MVCC.
That suggests the problem should go away when I query pg_tables
instead, but I haven't tried that yet.

This happens with 8.2.6 and 8.2.13, and only while there is
significant CREATE TEMPORARY TABLE/DROP TABLE activity in an other
backend process.

--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Btree indizes, FILLFACTOR, vacuum_freeze_min_age and CLUSTER
Next
From: Tom Lane
Date:
Subject: Re: Apparent race in information_schema.tables