Re: inherited table and rules - Mailing list pgsql-general

From Klint Gore
Subject Re: inherited table and rules
Date
Msg-id 42411BE9132.97F8KG@129.180.47.120
Whole thread Raw
In response to Re: inherited table and rules  (Klint Gore <kg@kgb.une.edu.au>)
Responses Re: inherited table and rules
List 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 by date:

Previous
From: Klint Gore
Date:
Subject: Re: inherited table and rules
Next
From: Shaun Clements
Date:
Subject: PLPGSQL