Re: BUG #11804: The delete rule problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: djlu126(at)126(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11804: The delete rule problem
Date: 2014-10-28 19:46:37
Message-ID: 31109.1414525597@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

djlu126(at)126(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Adrian Klaver 2014-10-28 19:58:29 Re: Need guidance on regression.diffs
Previous Message Tom Lane 2014-10-28 19:27:23 Re: BUG #11803: avoid "distinct" logic if "limit 1" specified