pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make pg_dump emit ATTACH PARTITION instead of PARTITION OF
Date: Wed, 24 Apr 2019 19:32:34 +0000
Message-ID: <E1hJNdC-0004i1-Bt@gemulon.postgresql.org> (raw)

Make pg_dump emit ATTACH PARTITION instead of PARTITION OF

Using PARTITION OF can result in column ordering being changed from the
database being dumped, if the partition uses a column layout different
from the parent's.  It's not pg_dump's job to editorialize on table
definitions, so this is not acceptable; back-patch all the way back to
pg10, where partitioned tables where introduced.

This change also ensures that partitions end up in the correct
tablespace, if different from the parent's; this is an oversight in
ca4103025dfe (in pg12 only).  Partitioned indexes (in pg11) don't have
this problem, because they're already created as independent indexes and
attached to their parents afterwards.

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.

Author: David Rowley
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/CAKJS1f_1c260nOt_vBJ067AZ3JXptXVRohDVMLEBmudX1YEx-A@mail.gmail.com
Discussion: https://postgr.es/m/20190423185007.GA27954@alvherre.pgsql

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a98c48debcd0620ab07608d53ee08fdb0e7a1edb

Modified Files
--------------
src/bin/pg_dump/pg_dump.c        | 123 ++++++++++++++++-----------------------
src/bin/pg_dump/t/002_pg_dump.pl |  12 +++-
2 files changed, 60 insertions(+), 75 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1hJNdC-0004i1-Bt@gemulon.postgresql.org>
Permalink:  ../E1hJNdC-0004i1-Bt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hJNdC-0004i1-Bt@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Make pg_dump emit ATTACH PARTITION instead of PARTITION OF
  In-Reply-To: <E1hJNdC-0004i1-Bt@gemulon.postgresql.org>
  References: <E1hJNdC-0004i1-Bt@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox