Re: Changing column order through dump and restore - Mailing list pgsql-admin

From Tom Lane
Subject Re: Changing column order through dump and restore
Date
Msg-id 6441.1467060977@sss.pgh.pa.us
Whole thread Raw
In response to Changing column order through dump and restore  (Alex Stanier <Alex.stanier@proactis.com>)
Responses Re: Changing column order through dump and restore
List pgsql-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


pgsql-admin by date:

Previous
From: Alex Stanier
Date:
Subject: Changing column order through dump and restore
Next
From: Alex Stanier
Date:
Subject: Re: Changing column order through dump and restore