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

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: Is it possible to redirect an update/insert/delete to a different table?
Дата
Msg-id 20051120170136.GC2832@kaufbach.delug.de
обсуждение исходный текст
Ответ на Re: Is it possible to redirect an update/insert/delete to a different table?  (Andy Ballingall <andy@areyoulocal.co.uk>)
Список pgsql-sql
Andy Ballingall <andy@areyoulocal.co.uk> schrieb:

> Hi Andreas,
> 
> The rule you've given only works for an update which changes the name.
> 
> If I do another update which changed the colour instead of the name, that
> rule wouldn't do the right thing.

Right.


> Instead, I'm looking for something which, with a single 'rule' (or whatever
> the mechanism ends up being), intercepts *any* update on apples, and applies
> the changes to the pears table instead, as if the only change that occurred
> was a change of table name.

My example was simple, right.


> I can achieve this in the application which generates the sql commands, but
> someone else suggested it was possible with rules, but it may not be the
> case.

Inside the rule you have the NEW-Variable with all values to update.
Read my other answer.
I'm not sure, perhaps it is possible to write a more generic rule.

> 
> -----Original Message-----

Please, no top-posting with silly fullquote below. 


HTH, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


В списке pgsql-sql по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Is it possible to redirect an update/insert/delete to a different table?
Следующее
От: Andy Ballingall
Дата:
Сообщение: Re: Is it possible to redirect an update/insert/delete to a different table?