pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <janwieck@Yahoo.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Joel Burton <jburton@scw.org>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Rules with Conditions: Bug, or Misunderstanding
Date: Sun, 3 Dec 2000 18:17:48 -0500 (EST)
Message-ID: <200012032317.SAA08604@jupiter.jw.home> (raw)
In-Reply-To: <19579.975544973@sss.pgh.pa.us>

Tom Lane wrote:
> "Joel Burton" <jburton@scw.org> writes:
> > create rule dev_ins as on update to dev_col_comments where
> > old.description isnull do instead insert into pg_description ( objoid,
> > description) values (old.att_oid, new.description);
>
> > create rule dev_upd as on update to dev_col_comments where
> > old.description notnull do instead update pg_description set
> > description=new.description where objoid=old.att_oid;
>
> > This doesn't work: I get a "cannot update view w/o rule" error
> > message, both for fields where description was null, and for fields
> > where it wasn't null.
>
> Hm.  Perhaps the "cannot update view" test is too strict --- it's not
> bright enough to realize that the two rules together cover all cases,
> so it complains that you *might* be trying to update the view.  As the
> code stands, you must provide an unconditional DO INSTEAD rule to
> implement insertion or update of a view.

    Disagree.

    A  conditional rule splits the command into two, one with the
    rules action and  the  condition  added,  one  which  is  the
    original  statement  plus the negated condition. So there are
    cases left where an INSERT can happen to  the  view  relation
    and it's the job of this test to prevent it.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #





view thread (11+ messages)  latest in thread

Message-ID: <200012032317.SAA08604@jupiter.jw.home>
Permalink:  ../200012032317.SAA08604@jupiter.jw.home/
Also on:    postgresql.org/message-id/200012032317.SAA08604@jupiter.jw.home

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: janwieck@Yahoo.com, tgl@sss.pgh.pa.us, jburton@scw.org, pgsql-hackers@postgresql.org
  Subject: Re: Rules with Conditions: Bug, or Misunderstanding
  In-Reply-To: <200012032317.SAA08604@jupiter.jw.home>
  References: <19579.975544973@sss.pgh.pa.us> <200012032317.SAA08604@jupiter.jw.home>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox