Thread: Rules

Rules

From
"Peeter Smitt"
Date:
Hi
 
I'm trying to make updateable view useing rules.
 
CREATE RULE update_rule AS ON UPDATE TO table DO INSTEAD
  SELECT fun1(new);
 
Thing is that backend gives this error.
  ERROR:  parser: parse error at or near ")"
 
What i'm doing wrong? Are there any other ways to make updatebale multi-table views?
 
thanks and joyfull new year.
 
-----------------------------------------
Peeter Smitt
AS Delfi Online
Pärnu mnt. 158
11317 Tallinn, Estonia
Tel +3726501734
GSM +37256647653
peeter.smitt@online.ee
www.delfi.ee

Re: Rules

From
Peter Eisentraut
Date:
Peeter Smitt writes:

> CREATE RULE update_rule AS ON UPDATE TO table DO INSTEAD
>   SELECT fun1(new);
>
> Thing is that backend gives this error.
>   ERROR:  parser: parse error at or near ")"

Try double quoting "new", since it's a reserved word.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



Re: Rules

From
Jan Wieck
Date:
Peeter Smitt wrote:
> Hi
>
> I'm trying to make updateable view useing rules.
>
> CREATE RULE update_rule AS ON UPDATE TO table DO INSTEAD
>   SELECT fun1(new);
>
> Thing is that backend gives this error.
>   ERROR:  parser: parse error at or near ")"
>
> What i'm doing wrong? Are there any other ways to make updatebale multi-table views?
   There  are,  but you haven't read the documentation about the   rule system, which is a common mistake.
   Read chapter 8  of  the  PostgreSQL  Programmers  manual  for   details on how to setup updateable views.


Jan

--

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