Re: Updating views : cannot figure out what goes wrong

From: Jaime Casanova <systemguards(at)yahoo(dot)com>
To: Dirk Cleenwerck <dirk(dot)cleenwerck(at)useitgroup(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Updating views : cannot figure out what goes wrong
Date: 2005-01-17 22:08:28
Message-ID: 20050117220828.48127.qmail@web50006.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

--- Dirk Cleenwerck <dirk(dot)cleenwerck(at)useitgroup(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tjibbe Rijpma 2005-01-17 23:45:59 How the get variables out of a plggsql RECORD by column number
Previous Message Tom Lane 2005-01-17 15:42:53 Re: Change the name of the database