pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Oliver Duke-Williams <o.duke-williams@geog.leeds.ac.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: Can a table have a reference to itself?
Date: Mon, 28 Jul 2003 01:31:29 -0400
Message-ID: <27090.1059370289@sss.pgh.pa.us> (raw)
In-Reply-To: <3F1E9F6E.2090600@geog.leeds.ac.uk>
References: <3F1E9F6E.2090600@geog.leeds.ac.uk>

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 | 1
 3 | 5
 5 | 5
(3 rows)

			regards, tom lane



view thread (3+ messages)

Message-ID: <27090.1059370289@sss.pgh.pa.us>
Permalink:  ../27090.1059370289@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27090.1059370289@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, o.duke-williams@geog.leeds.ac.uk
  Subject: Re: Can a table have a reference to itself?
  In-Reply-To: <27090.1059370289@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox