Re: inherited table and rules

Поиск
Список
Период
Сортировка
От Klint Gore
Тема Re: inherited table and rules
Дата
Msg-id 42411516298.97F7KG@129.180.47.120
обсуждение исходный текст
Ответ на inherited table and rules  (Scott Frankel <leknarf@pacbell.net>)
Ответы Re: inherited table and rules  (Klint Gore <kg@kgb.une.edu.au>)
Список pgsql-general
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   : 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 по дате отправления:

Предыдущее
От: "Sim Zacks"
Дата:
Сообщение: Re: multi line text data/query ?bug?
Следующее
От: Klint Gore
Дата:
Сообщение: Re: inherited table and rules