Re: Updating views : cannot figure out what goes wrong - Mailing list pgsql-novice

From Jaime Casanova
Subject Re: Updating views : cannot figure out what goes wrong
Date
Msg-id 20050117220828.48127.qmail@web50006.mail.yahoo.com
Whole thread Raw
In response to Updating views : cannot figure out what goes wrong  (Dirk Cleenwerck <dirk.cleenwerck@useitgroup.com>)
List pgsql-novice
 --- Dirk Cleenwerck <dirk.cleenwerck@useitgroup.com>
escribió:
> Hi there,
>
> strSql = "CREATE VIEW bondetailtmp AS SELECT * FROM
> bondetail WHERE
> subbonnr=" & Forms!bonnentest!bonnr & ";"
> cn.Execute strSql
> strSql = "CREATE RULE bondetailtmpupd AS ON UPDATE
> TO bondetailtmp " & _
>         "DO INSTEAD NOTHING;"
> cn.Execute strSql
> strSql = "CREATE RULE bondetailtmpupd2 AS ON UPDATE
> TO bondetailtmp " & _
>         "WHERE OLD.subbonbeschrijving <>
> NEW.subbonbeschrijving " & _
>         "DO (UPDATE bondetail " & _
>         "SET
> subbonbeschrijving=NEW.subbonbeschrijving);"
> cn.Execute strSql
> Forms!bonnentest.bondetailtmp.Form.RecordSource =
> "bondetailtmp"
>
> 476 2005-01-06 18:46:34ERROR:  cannot update a view
>
> 476 2005-01-06 18:46:34HINT:  You need an
> unconditional ON UPDATE DO
> INSTEAD rule.
>
Just like the message says to you: yo have to use
CREATE RULE ... DO INSTEAD not just DO.
If you just does CREAT RULE ... DO it will defaults to
ALSO so it will try to update the view itself the DO
INSTEAD says not to touch the view but instead of that
do this stmnt.

regards,
Jaime Casanova

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Change the name of the database
Next
From: "Tjibbe Rijpma"
Date:
Subject: How the get variables out of a plggsql RECORD by column number