Rules and locking within a transaction?...

Поиск
Список
Период
Сортировка
От Net Virtual Mailing Lists
Тема Rules and locking within a transaction?...
Дата
Msg-id 20041009235017.25998@mail.e-na.net
обсуждение исходный текст
Ответы Tsearch2 trigger firing...  ("Net Virtual Mailing Lists" <mailinglists@net-virtual.com>)
Список pgsql-general
Hello,

If I have a rule like this:


CREATE OR REPLACE RULE sometable_update AS ON UPDATE TO table2 DO UPDATE
cache SET updated_dt=NULL WHERE tablename='sometable';
CREATE OR REPLACE RULE sometable_insert AS ON INSERT TO table2 DO UPDATE
cache SET updated_dt=NULL WHERE tablename='sometable';
CREATE OR REPLACE RULE sometable_delete AS ON DELETE TO table2 DO UPDATE
cache SET updated_dt=NULL WHERE tablename='sometable';


Then I begin inserting a bunch of records within a transaction into
table2, like this:


BEGIN;
INSERT INTO table2 (val1, val2) VALUES ('hello','world');
...(etc)
COMMIT;

...  It appears that there is a row lock in cache table for the duration
of the transaction....

First of all, is my premise correct or is there some hidden problem I'm
not seeing?...

Secondly, if there is no hidden problem, is there some way (short of
dropping and recreating the rule) to make it not perform the row lock and
execute the rule at the end of the transaction (if the transaction
succeeds of course)?...

Thanks!

- Greg




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

Предыдущее
От: Bernard Clement
Дата:
Сообщение: Re: install problem
Следующее
От: "David Parker"
Дата:
Сообщение: external function libraries on non-build machine