Re: pg_dump LOCK TABLE ONLY question

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Filip Rembiałkowski <filip(dot)rembialkowski(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump LOCK TABLE ONLY question
Date: 2015-10-31 09:14:18
Message-ID: CANP8+jKY_T=8wteGFidbnQi+9iRQ02JVHop77NVGWVDMhHNd1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2 October 2015 at 01:19, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> On Thu, Oct 1, 2015 at 10:43 PM, Filip Rembiałkowski
> <filip(dot)rembialkowski(at)gmail(dot)com> wrote:
> > I just want to understand why there is LOCK TABLE not LOCK TABLE ONLY.
>
> It seems to me that you'd still want to use LOCK TABLE particularly if
> the dump is only done on a subset of tables, using --table for
> example.
>

I agree with Filip that this is a bug. pg_dump clearly doesn't work
correctly with inheritance.

If I run this command

pg_dump -t tab1

then I get a dump of "tab1". No data is included from tables that inherit
tab1 because COPY refers only to the target table.

Why should that action cause a lock to be taken on another table that
inherits from tab1?

It seems clear that the user is requesting an action ONLY on tab1, so we
should use LOCK TABLE tab1 ONLY;

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message konstantin knizhnik 2015-10-31 09:22:07 eXtensible Transaction Manager API
Previous Message Andres Freund 2015-10-31 09:00:52 Re: September 2015 Commitfest