Re: Two rules on a view do not like each other :-(

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: pg_general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Two rules on a view do not like each other :-(
Date: 2003-11-20 01:19:26
Message-ID: 20031119171825.N1114@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-11-20 01:26:31 Re: 7.4RC2 vs 7.4
Previous Message Peter Eisentraut 2003-11-20 00:59:27 Re: Pg_dumpall problem