Problem with dump/restore and inheritance

Chris Dunlop <chris@onthe.net.au>

From: Chris Dunlop <chris@onthe.net.au>
To: pgsql-bugs@postgresql.org
Date: 2006-02-22T07:44:00Z
Lists: pgsql-bugs
G'day all,

PG version: 8.1.0  (also 7.4.9)
OS: Linux (debian/testing)

Restoring a database with inherited tables can result in an
incorrect schema (and therefore inability to restore data).

E.g. using the script below, the 'bar.f1' column in the 'new'
database ends up with a 'not null' constraint that isn't present
in the 'orig' database.

Cheers,

Chris.

----------------------------------------------------------------------
#!/bin/sh
createdb orig
createdb new
psql orig <<END
  create table foo (f1 integer not null);
  create table bar () inherits(foo);
  alter table bar alter column f1 drop not null;
END
pg_dump orig | psql new
----------------------------------------------------------------------