From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | David Rowley <drowley(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pg_dump, ATTACH, and independently restorable child partitions |
Date: | 2020-10-24 19:59:49 |
Message-ID: | 20201024195949.GL9241@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Oct 23, 2020 at 12:29:40AM -0500, Justin Pryzby wrote:
> Since this commit, pg_dump CREATEs tables and then ATTACHes them:
>
> |commit 33a53130a89447e171a8268ae0b221bb48af6468
> |Author: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
> |Date: Mon Jun 10 18:56:23 2019 -0400
> |
> | Make pg_dump emit ATTACH PARTITION instead of PARTITION OF (reprise)
> |...
> | This change also has the advantage that the partition is restorable from
> | the dump (as a standalone table) even if its parent table isn't
> | restored.
>
> I like the idea of child tables being independently restorable, but it doesn't
> seem to work.
...
> Now that I look, it seems like this is calling PQexec(), which sends a single,
> "simple" libpq message with:
> |CREATE TABLE ..; ALTER TABLE .. ATTACH PARTITION;
> ..which is transactional, so when the 2nd command fails, the CREATE is rolled back.
> https://www.postgresql.org/docs/9.5/libpq-exec.html#LIBPQ-EXEC-MAIN
The easy fix is to add an explicit begin/commit.
--
Justin
Attachment | Content-Type | Size |
---|---|---|
0001-pg_dump-Allow-child-partitions-to-be-independently-r.patch | text/plain | 1.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2020-10-25 01:06:38 | Re: Parallel Append can break run-time partition pruning |
Previous Message | Dmitry Dolgov | 2020-10-24 16:45:53 | Re: Index Skip Scan (new UniqueKeys) |