Re: Multiple-statement Rules Incompatible With Constraints - Mailing list pgsql-hackers

From Curt Sampson
Subject Re: Multiple-statement Rules Incompatible With Constraints
Date
Msg-id Pine.NEB.4.62.0505280119210.9361@angelic.cynic.net
Whole thread Raw
In response to Re: Multiple-statement Rules Incompatible With Constraints  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, 27 May 2005, Tom Lane wrote:

> Same old same old: as soon as you've deleted from offer_mutable, there
> is no row in the view with the given offer_id; and since OLD is a macro
> for the view, the second delete finds nothing to do.

Oh, now I'm starting to see how this behavior does make sense...unwanted
as it is in my case. Maybe I find it a bit weird that the sense of
OLD.something can change within a rule, though.

> You might be able to fix this by making the view an outer join, and
> deleting from the nullable side first.

Yuck. Though I'm already deep in "yuck" anyway.

> The whole data structure seems a tad weird though ...

More than a tad. I'm not happy with this thing I've come up with. I'm
really starting to think that I took the wrong path. What's a better way
to express my intention?

Perhaps the thing to do is go back to one table, and have a trigger that
throws an exception if you try to update the "non-updatable" columns.
(And only the test account can do deletes--if I need to do an update
during testing, delete and insert is the answer.) What do you think?

But as well, this is really also another instance of an area where
functions work differently from things not in functions (and I tend to
think that the way things work in functions in most of these cases is
right).

cjs
-- 
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.NetBSD.org     Make up enjoying your city life...produced
byBIC CAMERA
 


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: WAL replay failure after file truncation(?)
Next
From: Mario Weilguni
Date:
Subject: overlaps() does not work as expected?