Re: Database Backup/Restore with Inherited Tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dawn Hollingsworth <dmh(at)airdefense(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Database Backup/Restore with Inherited Tables
Date: 2003-05-23 17:29:08
Message-ID: 17124.1053710948@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Dawn Hollingsworth <dmh(at)airdefense(dot)net> 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Stephan Szabo 2003-05-23 17:32:05 Re: return multiple rows
Previous Message Joe Conway 2003-05-23 17:28:35 Re: upgrade issue