Re: inherited table and rules

Поиск
Список
Период
Сортировка
Искать
От
Klint Gore
Тема
Re: inherited table and rules
Дата
Msg-id
42411BE9132.97F8KG@129.180.47.120
Ответ на
Список
Дерево обсуждения
inherited table and rules Scott Frankel <leknarf@pacbell.net>
Re: inherited table and rules Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: inherited table and rules Scott Frankel <leknarf@pacbell.net>
Re: inherited table and rules Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: inherited table and rules Michael Fuhr <mike@fuhr.org>
Re: inherited table and rules Thomas F.O'Connell <tfo@sitening.com>
Re: inherited table and rules Klint Gore <kg@kgb.une.edu.au>
Re: inherited table and rules Klint Gore <kg@kgb.une.edu.au>
Re: inherited table and rules Scott Frankel <leknarf@pacbell.net>
Re: inherited table and rules "Jim Buttafuoco" <jim@contactbda.com>
Re: inherited table and rules Klint Gore <kg@kgb.une.edu.au>
Re: inherited table and rules Scott Frankel <leknarf@pacbell.net>
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
FAQ