pg-dump bug (at 6.4)

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: hackers(at)postgreSQL(dot)org
Subject: pg-dump bug (at 6.4)
Date: 1998-11-16 11:50:34
Message-ID: 199811161150.LAA04763@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"Therefore being justified by faith, we have peace
with God through our Lord Jesus Christ." Romans 5:1

Browse pgsql-hackers by date

  From Date Subject
Next Message Taral 1998-11-16 15:25:24 RE: [HACKERS] SQL vs. OQL
Previous Message Michael Meskes 1998-11-16 11:31:51 Re: [HACKERS] More PostgreSQL+CORBA