Re: Multiple-statement Rules Incompatible With Constraints

From: Curt Sampson <cjs(at)cynic(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Multiple-statement Rules Incompatible With Constraints
Date: 2005-05-27 16:27:01
Message-ID: Pine.NEB.4.62.0505280119210.9361@angelic.cynic.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cynic(dot)net> +81 90 7737 2974 http://www.NetBSD.org
Make up enjoying your city life...produced by BIC CAMERA

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mario Weilguni 2005-05-27 16:35:32 overlaps() does not work as expected?
Previous Message David Parker 2005-05-27 15:56:35 Re: logging sql from JDBC