Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 10CF5B5DC08 for ; Thu, 18 Aug 2011 17:00:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 07542-05 for ; Thu, 18 Aug 2011 20:00:03 +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 B4EAAB5DBF3 for ; Thu, 18 Aug 2011 17:00:02 -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 p7IJxvC9003309; Thu, 18 Aug 2011 15:59:57 -0400 (EDT) To: Jesper Engman cc: Simon Riggs , pgsql-bugs Subject: Re: BUG #6167: pg_dump fails on table lock In-reply-to: References: <201108180105.p7I15VEk025312@wwwmaster.postgresql.org> Comments: In-reply-to Jesper Engman message dated "Thu, 18 Aug 2011 12:04:30 -0700" Date: Thu, 18 Aug 2011 15:59:57 -0400 Message-ID: <3308.1313697597@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.037 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.137 X-Spam-Level: X-Archive-Number: 201108/111 X-Sequence-Number: 30923 Jesper Engman writes: > I wonder if there is a small time span between when pg_dump starts and > when all locks have been acquired that may be the problem (if a table > is dropped during that time span). Is there such a small time of > vulnerability? Certainly. pg_dump has to read pg_class to get the names of the tables, and then try to lock each one. If you drop a table during that window, the lock command will fail. The window is actually a bit longer than necessary in existing releases, because pg_dump was doing some other stuff before it got around to acquiring the locks. I fixed that recently http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=68d977a73 but that patch hasn't made it to any released versions yet. In any case there's still a nonzero window. > Excluding tables from the dump is not an option - that will be an > incomplete backup. Um ... if you know it's a transient table, why do you care about backing it up? regards, tom lane