Skip site navigation (1) Skip section navigation (2)

Re: BUG #2119: FOREIGN KEY ON DELETE RESTRICT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Fred Perni " <perniss(at)zks-gmbh(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2119: FOREIGN KEY ON DELETE RESTRICT
Date: 2005-12-20 15:18:35
Message-ID: 29342.1135091915@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Fred Perni" <perniss(at)zks-gmbh(dot)de> writes:
> If I delete a dataset from p_kto then is also delete the referenced sets in
> depot.
> Normaly the RESTRICT should prevents deletion. Or?

Works for me:
regression=# delete from p_kto where kto_id = 101;
ERROR:  update or delete on "p_kto" violates foreign key constraint "c_dkt_kto_id" on "depot"
DETAIL:  Key (kto_id)=(101) is still referenced from table "depot".

I think you've not told us the full truth about your tables.  The quoted
definitions are syntactically wrong (missing commas) and semantically
wrong (kto_id has no UNIQUE or PRIMARY KEY constraint, therefore can't
be the target of a foreign key reference).  I think you stripped out
everything you thought was irrelevant, including the actual source of
the problem --- maybe there is another constraint that is ON DELETE
CASCADE, and it happens to get processed first?

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-12-20 15:20:49
Subject: Re: BUG #2118: could not connect to server
Previous:From: Devrim GUNDUZDate: 2005-12-20 15:09:56
Subject: Re: BUG #2118: could not connect to server

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group