Re: RULE - special variables? - Mailing list pgsql-general

From Matthew Peter
Subject Re: RULE - special variables?
Date
Msg-id 20061110020600.36981.qmail@web35208.mail.mud.yahoo.com
Whole thread Raw
In response to Re: RULE - special variables?  (Richard Huxton <dev@archonet.com>)
List pgsql-general
--- Richard Huxton <dev@archonet.com> wrote:

> Matthew Peter wrote:
> > Do rules get special variables like triggers? Can I set variables in them like
> > triggers?
>
> You get NEW/OLD but they mean something subtly different. Rules act on a
> query-tree so they are more like placeholders.
>
> You can't set variables in triggers. You do so in a function. If your
> rule calls a function, that could have variables.

You can set variables in triggers in the DECLARE block when plpgsql is used.

Reading the docs they only show single-statement rules so it never said assigning
could be done so here I am. Sometimes it's easier to write a quick rule than a
trigger function and separate firing condition, especially when they function so
similiarily in theory. Thanks.




____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

pgsql-general by date:

Previous
From: Matthew Peter
Date:
Subject: Re: dblink / plpgsql - definition list cheats for record
Next
From: "Thomas H."
Date:
Subject: Re: planer picks a bad plan (seq-scan instead of index) when adding an additional join