Re: Is it possible to redirect an update/insert/delete to a different table?

From: "JuanCri" <juancri(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Is it possible to redirect an update/insert/delete to a different table?
Date: 2005-11-20 06:43:33
Message-ID: 1132469013.246334.171700@g49g2000cwa.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I don't know what do you mean... because if you want to insert to other
table.. you can create a rule like this

CREATE RULE myrule AS ON INSERT
TO mytable
DO INSTEAD INSERT INTO myothertable VALUES (NEW.col1, NEW.col2,
NEW.col3);

that will work for all inserts.. I think the problem will be the
SELECT, right?... well.. that's solved if "mytable" is a view of SELECT
* FROM myothertable..

Juan C. Olivares
www.juancri.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message JuanCri 2005-11-20 07:01:57 Re: query
Previous Message rsosnowski 2005-11-20 03:03:04 Create Public Schema