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

Поиск
Список
Период
Сортировка
От JuanCri
Тема Re: Is it possible to redirect an update/insert/delete to a different table?
Дата
Msg-id 1132469013.246334.171700@g49g2000cwa.googlegroups.com
обсуждение исходный текст
Ответ на Is it possible to redirect an update/insert/delete to a different table?  (Andy Ballingall <andy@areyoulocal.co.uk>)
Список 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 по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: How to change database owner in PostgreSQL 7.4?
Следующее
От: "JuanCri"
Дата:
Сообщение: Re: query