Re: BUG #11804: The delete rule problem - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #11804: The delete rule problem
Date
Msg-id 31109.1414525597@sss.pgh.pa.us
Whole thread Raw
In response to BUG #11804: The delete rule problem  (djlu126@126.com)
List pgsql-bugs
djlu126@126.com writes:
> [ complicated example ]

It's pretty much a crapshoot what you're going to get out of that
details_d1 rule, because it specifies multiple updates to the same
row of the "stock" table anytime multiple "details" rows with the
same "prd_id" are deleted.  That's allowed but only one of the update
actions will take, and it's unspecified which one.  (There's been
some talk of making such cases throw an error instead, but that wouldn't
lead to a working solution for you either.)

You'd be *way* better off building this behavior with a trigger,
both as to efficiency and understandability.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #11803: avoid "distinct" logic if "limit 1" specified
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] Need guidance on regression.diffs