I thought that all rows in inherited tables are visible to the table
that they are inherited from (ie all rows in people_history are visible
to people).

step by step would be 
> INSERT INTO people (usr_name, color) VALUES ('bob',   'red');

make one row in people

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

rule fires inserting new row into people_history making 2 rows visible
in people.
not instead rule so update happens causing 2 rows updated.

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

rule fires for each row updated making 2 new rows per original visible row
(ends up with 6 rows)
not instead rule so update happens causing 6 rows updated.

> -- update table (3) -- 42
> UPDATE people SET color = 'yellow' WHERE usr_pkey = 1;
6inserts * 6 updates + original 6 = 42

> -- update table (4) -- 1806
> UPDATE people SET color = 'black' WHERE usr_pkey = 1;
42*42+42 = 1806

klint.

+---------------------------------------+-----------------+
: Klint Gore                            : "Non rhyming    :
: EMail   : [EMAIL PROTECTED]           :  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             :                 :
+---------------------------------------+-----------------+

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to