X-Original-To: pgsql-admin@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id C7E30924FC6 for ; Fri, 23 May 2003 13:42:47 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 35297-05 for ; Fri, 23 May 2003 13:42:40 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id 823659252AF for ; Fri, 23 May 2003 13:29:10 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4NHT8U6017125; Fri, 23 May 2003 13:29:09 -0400 (EDT) To: Dawn Hollingsworth Cc: pgsql-admin@postgresql.org Subject: Re: Database Backup/Restore with Inherited Tables In-reply-to: <1053660043.1929.47.camel@kaos> References: <1053660043.1929.47.camel@kaos> Comments: In-reply-to Dawn Hollingsworth message dated "23 May 2003 03:20:43 -0000" Date: Fri, 23 May 2003 13:29:08 -0400 Message-ID: <17124.1053710948@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/337 X-Sequence-Number: 8899 Dawn Hollingsworth writes: > The problem arose when this migrated database was backed > up and restored. When the base table was altered the new columns were > added to the end of the inherited table automatically( base table > columns, inherited table additional columns, new base table columns). > But if you backup and restore the schema changes to base table, new base > table columns then inherited table additional columns. Unfortunately the > data is in the other order. Yeah, this is a longstanding gotcha with adding columns to parent tables :-(. It's solved in 7.3 by explicitly specifying the column order in each COPY command issued by pg_dump. If you are trying to migrate to 7.3 then the solution is to use 7.3's pg_dump against the 7.2 server to produce the dump. If you need to transport data within 7.2 or before, I think the only simple answer is to use pg_dump's -D option so that the data is dumped as explicitly labeled INSERTs. It's a lot slower but it will work. regards, tom lane