Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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

Curt Sampson  <cjs(at)cynic(dot)net>   +81 90 7737 2974
      Make up enjoying your city life...produced by BIC CAMERA

In response to

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group