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.