question on UPDATE rules

Поиск
Список
Период
Сортировка
От Matthew Denny
Тема question on UPDATE rules
Дата
Msg-id 14592.60375.884848.74935@caracas.CS.Berkeley.EDU
обсуждение исходный текст
Ответы Re: question on UPDATE rules  (wieck@debis.com (Jan Wieck))
Re: question on UPDATE rules  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
I have a rule defined as the following:

CREATE RULE fooBar AS ON
UPDATE TO VectorMessageTable WHERE new.acks = (SELECT
numReplicas FROM VectorTable vt WHERE vt.ID =
new.ID) DO (DELETE FROM VectorMessageTable WHERE ID = new.ID AND
versionNum = new.versionNum);

if I call: 

UPDATE VectorMessageTable SET acks =
<corresponding-numReplicas-from-VectorTable>

Then I the update goes through, but none of the records are
deleted. However, if I run any other subsequent update on these tuples in
VectorMessageTable (even ones that change the acks value) then the
rule fires and the tuples are deleted.  The crux of the problem seems
to be that the "new" pseudo-relation seems to be returning old values, 
as this is the only way I can explain this behavior.  Has anyone else
experienced this problem?  If so, a workaround would be greatly
appreciated.

thanks,
Matt Denny



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: TOAST (was: BLOB)
Следующее
От: Christopher Sawtell
Дата:
Сообщение: Re: Date_part & cast.