Edge case problem with pg_dump - Mailing list pgsql-hackers

From D'Arcy J.M. Cain
Subject Edge case problem with pg_dump
Date
Msg-id 20020522095124.A25017@druid.net
Whole thread Raw
Responses Re: Edge case problem with pg_dump
List pgsql-hackers
There seems to be a pg_dump issue with inherited tables when columns
are added to the parent table after creating the child table.  Here is
how to repeat the problem.

Create a test database and run the following SQL statements:

create table a (x int);
create table b (y int) inherits (a);
alter table a add column z int;
insert into b values (1, 2, 3);
select * from b;

You should see this:

test1=# select * from b;x | y | z
---+---+---1 | 2 | 3(1 row)

Now create a second test database and dump the first into the second:

pg_dump test1 | psql test2

Now try that last select statement in the new database and you will see:

test2=# select * from b;x | z | y
---+---+---1 | 2 | 3(1 row)

If you are lucky the restore fails because of conflicting types.  Worse, as
in this example, the types are the same and it silently messes up your data
by reversing the names on two columns.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Redhat 7.3 time manipulation bug
Next
From: Ewald Geschwinde
Date:
Subject: index a datatype