Re: Can a table have a reference to itself? - Mailing list pgsql-sql

From Tom Lane
Subject Re: Can a table have a reference to itself?
Date
Msg-id 27090.1059370289@sss.pgh.pa.us
Whole thread Raw
In response to Can a table have a reference to itself?  (Oliver Duke-Williams <o.duke-williams@geog.leeds.ac.uk>)
List pgsql-sql
Oliver Duke-Williams <o.duke-williams@geog.leeds.ac.uk> writes:
> So far so good, but what I'd like to do is to be able to change a value 
> of a, and have this cascaded to b; however this gives an integrity 
> violation error:

>> update foo set a = 5 where a = 2;
> ERROR:  chk_a referential integrity violation - key referenced from foo 
> not found in foo

Seems to work in 7.3.4 and CVS tip:

regression=# update foo set a = 5 where a = 2;
UPDATE 1
regression=# select * from foo;a | b
---+---1 | 13 | 55 | 5
(3 rows)
        regards, tom lane


pgsql-sql by date:

Previous
From: "David Witham"
Date:
Subject: Using a compound primary key
Next
From: Tom Lane
Date:
Subject: Re: Using a compound primary key