Apparent race in information_schema.tables

From: Florian Weimer <fweimer(at)bfk(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Apparent race in information_schema.tables
Date: 2009-05-11 16:29:43
Message-ID: 82tz3rli14.fsf@mid.bfk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)bfk(dot)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-05-11 17:00:01 Re: Apparent race in information_schema.tables
Previous Message Scott Marlowe 2009-05-11 16:25:25 Re: Btree indizes, FILLFACTOR, vacuum_freeze_min_age and CLUSTER