Re: Rules with Conditions: Bug, or Misunderstanding

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: Rules with Conditions: Bug, or Misunderstanding
Дата
Msg-id 200012032317.SAA08604@jupiter.jw.home
обсуждение исходный текст
Ответ на Re: Rules with Conditions: Bug, or Misunderstanding  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Rules with Conditions: Bug, or Misunderstanding  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
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 #




В списке pgsql-sql по дате отправления:

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: subselects
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: problem with keyword 'old'