Re: Two rules on a view do not like each other :-( - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Two rules on a view do not like each other :-(
Date
Msg-id 20031119171825.N1114@megazone.bigpanda.com
Whole thread Raw
In response to Two rules on a view do not like each other :-(  (Dmitry Tkach <dmitry@openratings.com>)
Responses Re: Two rules on a view do not like each other :-(  (Dima Tkach <dmitry@openratings.com>)
List pgsql-general
On Wed, 19 Nov 2003, Dmitry Tkach wrote:

> rapidb=# select version ();
>                            version
> -------------------------------------------------------------
>  PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC 2.96
> (1 row)
> rapidb=# create table test (x int primary key, y int);
> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> 'test_pkey' for table 'test'
> CREATE TABLE
> rapidb=# create view test_proxy as select * from test;
> CREATE VIEW
> rapidb=# create rule new_test_proxy as on insert to test_proxy do delete
> from test where x=new.x;
> CREATE RULE
> rapidb=# create rule new_test as on insert to test_proxy do instead
> insert into test values (new.x, new.y);

As a side note, you might just want to write one rule with two actions to
do this because that gets you whatever ordering you want by ordering the
actions.

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Pg_dumpall problem
Next
From: Alex
Date:
Subject: Export CSV from psql