Re: inherited table and rules

Поиск
Список
Период
Сортировка
От Klint Gore
Тема Re: inherited table and rules
Дата
Msg-id 42411BE9132.97F8KG@129.180.47.120
обсуждение исходный текст
Ответ на Re: inherited table and rules  (Klint Gore <kg@kgb.une.edu.au>)
Ответы Re: inherited table and rules  (Scott Frankel <leknarf@pacbell.net>)
Список pgsql-general
I think you can get what you want if you change the rule definition to

CREATE RULE
people_upd_history AS ON UPDATE TO people
DO INSERT INTO
people_history
SELECT * FROM only people WHERE usr_pkey = old.usr_pkey;

and your updates to be only's

-- update table (1) -- 2
UPDATE ONLY people SET color = 'cyan' WHERE usr_pkey = 1;

-- update table (2) -- 6
UPDATE ONLY people SET color = 'magenta' WHERE usr_pkey = 1;

-- update table (3) -- 42
UPDATE ONLY people SET color = 'yellow' WHERE usr_pkey = 1;

-- update table (4) -- 1806
UPDATE ONLY people SET color = 'black' WHERE usr_pkey = 1;

klint.

+---------------------------------------+-----------------+
: Klint Gore                            : "Non rhyming    :
: EMail   : kg@kgb.une.edu.au           :  slang - the    :
: Snail   : A.B.R.I.                    :  possibilities  :
: Mail      University of New England   :  are useless"   :
:           Armidale NSW 2351 Australia :     L.J.J.      :
: Fax     : +61 2 6772 5376             :                 :
+---------------------------------------+-----------------+

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

Предыдущее
От: Klint Gore
Дата:
Сообщение: Re: inherited table and rules
Следующее
От: Shaun Clements
Дата:
Сообщение: PLPGSQL