Re: "could not open relation..."

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Cox <brian(dot)cox(at)ca(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: "could not open relation..."
Date: 2010-04-13 19:25:01
Message-ID: 8614.1271186701@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Brian Cox <brian(dot)cox(at)ca(dot)com> writes:
> On 04/10/2010 12:29 AM, Tom Lane [tgl(at)sss(dot)pgh(dot)pa(dot)us] wrote:
>> but anyway: the main
>> known cause for that is if one of the tables used in the query got
>> dropped (by another session) just after the query started. Could
>> that have happened to you?

> interesting and possible; but why doesn't locking prevent this?

Locking prevents you from getting some random internal failure
that would happen if the table disappeared mid-query. It cannot
eliminate the problem altogether, because the issue here is that
the dropping transaction got there first; there is no reason not
to allow it to proceed. So the reading transaction is going to fail.
The most we could change is the spelling of the error message,
but I'm not sure that masking the fact that something odd happened
is a good idea. (From the reader's viewpoint, it did see a table
by that name in the catalogs, but by the time it acquired lock on
the table, the catalog entry was gone. Playing dumb and just saying
"table does not exist" could be even more confusing than the current
behavior.)

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2010-04-13 21:55:22 Re: stats collector suddenly causing lots of IO
Previous Message Cédric Villemain 2010-04-13 18:13:50 Re: stats collector suddenly causing lots of IO