Re: Is it possible to redirect an update/insert/delete to a different table? - Mailing list pgsql-sql

From JuanCri
Subject Re: Is it possible to redirect an update/insert/delete to a different table?
Date
Msg-id 1132469013.246334.171700@g49g2000cwa.googlegroups.com
Whole thread Raw
In response to Is it possible to redirect an update/insert/delete to a different table?  (Andy Ballingall <andy@areyoulocal.co.uk>)
List 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



pgsql-sql by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: How to change database owner in PostgreSQL 7.4?
Next
From: "JuanCri"
Date:
Subject: Re: query