pg_dump has improved a lot since 6.3.2, but here is one bug that relates
to inheritance, where a parent table has constraints.
These are the original table definitions:
create table individual
( gender char(1) check (gender = 'M' or gender = 'F' or
gender is null), born datetime check ((born >= '1 Jan 1880' and born
<= 'today') or born is null), surname text, forenames text, title text,
old_surname text, mobile text, ni_no text,
constraint is_named check (not (surname isnull and forenames isnull))
) inherits (person)
;
create table outworker
( started datetime not null, finish datetime
) inherits (individual)
;
This is the output from trying to reload the pg_dump output:
CREATE TABLE "individual" ("gender" char(1), "born" "datetime", "surname"
"text", "forenames" "text", "title" "text", "old_surname" "text", "mobile"
"text", "ni_no" "text", CONSTRAINT is_named CHECK (NOT ( surname IS NULL AND
forenames IS NULL )), CONSTRAINT individual_born CHECK (( born >= '1 Jan
1880' AND born <= 'today' ) OR born IS NULL), CONSTRAINT individual_gender
CHECK (gender = 'M' OR gender = 'F' OR gender IS NULL)) inherits ( "person");
CREATE
CREATE TABLE "outworker" ("started" "datetime" NOT NULL, "finish" "datetime",
CONSTRAINT individual_gender CHECK (gender = 'M' OR gender = 'F' OR gender IS
NULL), CONSTRAINT individual_born CHECK (( born >= '1 Jan 1880' AND born <=
'today' ) OR born IS NULL), CONSTRAINT is_named CHECK (NOT ( surname IS NULL
AND forenames IS NULL ))) inherits ( "individual");
ERROR: DefineRelation: name (individual_gender) of CHECK constraint duplicated
The problem is that pg_dump is unnecessarily restating the constraints for
the parent table in its descendants.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver PGP key from public servers; key
ID32B8FAA1 ======================================== "Therefore being justified by faith, we have
peace with God through our Lord Jesus Christ." Romans 5:1