Re: rules

From: Joel Burton <jburton(at)scw(dot)org>
To: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: rules
Date: 2001-04-26 20:53:47
Message-ID: Pine.LNX.4.21.0104261652140.3977-100000@olympus.scw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 26 Apr 2001, [iso-8859-1] Martn Marqus wrote:

> Is it posible to make a rule execute more then one query?
>
> Something like:
>
> CREATE RULE rule_name AS ON INSERT TO table1
> DO INSTEAD
> INSERT INTO table2 VALUES
> (new.value1,new.value2)
> INSERT INTO table3 VALUES
> (x,y)

test=# \h create rule
Command: CREATE RULE
Description: Defines a new rule
Syntax:
CREATE RULE name AS ON event
TO object [ WHERE condition ]
DO [ INSTEAD ] action

where action can be:

NOTHING
|
query
|
( query ; query ... )
|
[ query ; query ... ]

ie

CREATE RULE snog AS ON UPDATE TO foo DO INSTEAD ( ...; ... );

--
Joel Burton <jburton(at)scw(dot)org>
Director of Information Systems, Support Center of Washington

In response to

  • rules at 2001-04-26 14:21:48 from Martín Marqués

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2001-04-26 21:24:18 Re: rules
Previous Message Joel Burton 2001-04-26 20:35:33 Re: random rows