From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alex Stanier <Alex.stanier@proactis.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Changing column order through dump and restore
Date: Mon, 27 Jun 2016 16:56:17 -0400
Message-ID: <6441.1467060977@sss.pgh.pa.us> (raw)
In-Reply-To: <HE1PR0501MB2363159ACDAE1244C0C2E636FC210@HE1PR0501MB2363.eurprd05.prod.outlook.com>
References: <HE1PR0501MB2363159ACDAE1244C0C2E636FC210@HE1PR0501MB2363.eurprd05.prod.outlook.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
Alex Stanier <Alex.stanier@proactis.com> writes:
> # Dump the database (schema only)
> pg_dump -s my_database > my_database_schema.dmp
> # Dump the database (data only) as insert statements and with commands to disable triggers
> pg_dump -a --disable-triggers --column-inserts my_database > my_database_data.dmp
> I understand the data restore will be slow (due to the inefficiency of
> the INSERT statements), but is this a valid way to go about column
> re-ordering?
FWIW, you shouldn't need to use --column-inserts mode, because even in
default COPY output, pg_dump emits column name lists in the COPY commands.
So the right things should happen when reloading into a database with
modified column order.
Haven't thought about it in great detail, but your plan sounds generally
sane otherwise.
regards, tom lane
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, Alex.stanier@proactis.com
Subject: Re: Changing column order through dump and restore
In-Reply-To: <6441.1467060977@sss.pgh.pa.us>
* 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