Re: pg_dump LOCK TABLE ONLY question - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: pg_dump LOCK TABLE ONLY question
Date
Msg-id CANP8+jKY_T=8wteGFidbnQi+9iRQ02JVHop77NVGWVDMhHNd1Q@mail.gmail.com
Whole thread Raw
In response to Re: pg_dump LOCK TABLE ONLY question  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: pg_dump LOCK TABLE ONLY question  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
On 2 October 2015 at 01:19, Michael Paquier <michael.paquier@gmail.com> wrote:
On Thu, Oct 1, 2015 at 10:43 PM, Filip Rembiałkowski
<filip.rembialkowski@gmail.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/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: September 2015 Commitfest
Next
From: konstantin knizhnik
Date:
Subject: eXtensible Transaction Manager API