Re: FW: BUG in trigger and foreign keys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jefim Matskin" <JefimM(at)sphera(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FW: BUG in trigger and foreign keys
Date: 2002-12-25 04:07:58
Message-ID: 23364.1040789278@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jefim Matskin" <JefimM(at)sphera(dot)com> writes:
> If try it with the same script - but without the constraints - you will see the difference.
> And there should not be any since the data is the same in the tables.

No, it's not the same. Consider the implications of the constraint
you added:

ALTER TABLE reseller ADD CONSTRAINT FK_reseller_parent
FOREIGN KEY (parent_id) REFERENCES reseller(reseller_id)
ON DELETE CASCADE ON UPDATE CASCADE;
^^^^^^^^^^^^^^^^^

This will cause the delete of reseller_id 1338 to propagate to the rows
in which 1338 appears as parent_id. Which sure looks to me like it's
the behavior you're complaining of.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jefim Matskin 2002-12-25 07:55:58 Re: FW: BUG in trigger and foreign keys
Previous Message Juraj Fedel 2002-12-24 18:19:20 tools for design