Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHdbe-0006UU-PW for pgsql-admin@arkaria.postgresql.org; Mon, 27 Jun 2016 20:58:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bHdbd-0002X0-Lf for pgsql-admin@arkaria.postgresql.org; Mon, 27 Jun 2016 20:58:09 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bHdZx-0000e8-7a for pgsql-admin@postgresql.org; Mon, 27 Jun 2016 20:56:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bHdZq-0008Ia-Mu for pgsql-admin@postgresql.org; Mon, 27 Jun 2016 20:56:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u5RKuHjP006442; Mon, 27 Jun 2016 16:56:17 -0400 From: Tom Lane To: Alex Stanier cc: "pgsql-admin@postgresql.org" Subject: Re: Changing column order through dump and restore In-reply-to: References: Comments: In-reply-to Alex Stanier message dated "Mon, 27 Jun 2016 13:49:11 -0000" Date: Mon, 27 Jun 2016 16:56:17 -0400 Message-ID: <6441.1467060977@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Alex Stanier 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