Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id EB707633A9F for ; Tue, 13 Apr 2010 16:25:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 99541-05 for ; Tue, 13 Apr 2010 19:25:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 261F6633920 for ; Tue, 13 Apr 2010 16:25:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o3DJP1UA008615; Tue, 13 Apr 2010 15:25:02 -0400 (EDT) To: Brian Cox cc: "pgsql-performance@postgresql.org" Subject: Re: "could not open relation..." In-reply-to: <4BC149DD.1090908@ca.com> References: <4BC149DD.1090908@ca.com> Comments: In-reply-to Brian Cox message dated "Sat, 10 Apr 2010 21:02:37 -0700" Date: Tue, 13 Apr 2010 15:25:01 -0400 Message-ID: <8614.1271186701@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.12 tagged_above=-10 required=5 tests=AWL=-0.210, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201004/169 X-Sequence-Number: 38419 Brian Cox writes: > On 04/10/2010 12:29 AM, Tom Lane [tgl@sss.pgh.pa.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