Re: ON DELETE CASCADE with multiple paths - Mailing list pgsql-bugs

From Max Khon
Subject Re: ON DELETE CASCADE with multiple paths
Date
Msg-id 4652A9FE.5090804@swsoft.com
Whole thread Raw
In response to Re: ON DELETE CASCADE with multiple paths  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: ON DELETE CASCADE with multiple paths  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-bugs
Stephan Szabo wrote:

>>>>> "delete from foo" fails:
>>>>> ERROR: update or delete on table "bar" violates foreign key constraint
>>>>> "foobar_fk0" on table "foobar"
>>>>> SQL state: 23503
>>>>> Detail: Key (bar_id)=(1) is still referenced from table "foobar".
>>>>> Context: SQL statement "DELETE FROM ONLY "public"."bar" WHERE "foo_id" = $1"
>>>> I see no bug here.  There is no guarantee about the order in which
>>>> constraints are applied.
>>> Except that SQL92 at least does seem to say in 11.8 that "All rows that
>>> are marked for deletion are effectively deleted at the end of the
>>> SQL-statement, prior to the checking of any integrity constraints." I
>>> think that likely makes our behavior wrong, but I'm not really sure how to
>>> get there from what we have now.
>> Is it sufficient to execute ON DELETE CASCADE and ON DELETE SET
>> NULL/DEFAULT triggers before other triggers?
>
> Hmm, I'm not sure. I'm not sure if that's sufficient and that it doesn't
> add any holes, but we can check that.

> At least I think on set default
> triggers we'd need to do something with the check performed from inside
> the trigger.

What's wrong with this check? Can you please elaborate?

btw does postgresql project have bugzilla or something like that? I
can't find it on http://postgresql.org/

--
Max Khon
PEM Platform Team Leader
SWsoft, Inc.
E-mail: mkhon@swsoft.com
Web Site: http://swsoft.com/

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #3277: error occurs between different versions
Next
From: "S. Robert James"
Date:
Subject: BUG #3296: CASCADING FKs dont DEFER