Re: RI Bug In Inherited Table

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: cn cn <cnliou(at)graffiti(dot)net>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: RI Bug In Inherited Table
Date: 2003-03-12 14:48:39
Message-ID: 20030312064638.L52741-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 12 Mar 2003, cn cn wrote:

> CREATE TABLE tt1 (
> c1int primary key
> )WITHOUT OIDS;
>
> CREATE TABLE tt2 (
> PRIMARY KEY (c1,c2),
> c1int,
> c2int
> )INHERITS (tt1) WITHOUT OIDS;
>
> CREATE TABLE tt3 (
> CONSTRAINT fktt3c1 FOREIGN KEY (c1) REFERENCES tt1 (c1),
> PRIMARY KEY (c1,c2),
> c1int,
> c2int,
> c3int
> )WITHOUT OIDS;
>
> INSERT INTO tt2 VALUES(1,2);
> INSERT INTO tt3 VALUES(1,2,3); --This statement produces fktt3c1 referential integrity violation

Referential integrity only applies to the named table and not
any child tables. Inheritance needs alot of work (for example,
you can have duplicated c1 values in the inherited tt1 tree because
the uniqueness constraint on tt1.c1 isn't inherited)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2003-03-12 14:50:25 Re: op error no question, but no error warning
Previous Message Theodore Petrosky 2003-03-12 14:09:42 op error no question, but no error warning