Re: Triggers on transaction?

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Re: Triggers on transaction?
Дата
Msg-id VisenaEmail.bf.c8a67230d3d08146.14d956f18d1@tc7-visena
обсуждение исходный текст
Ответ на Re: Triggers on transaction?  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: Triggers on transaction?  (Glyn Astill <glynastill@yahoo.co.uk>)
Список pgsql-hackers
På onsdag 27. mai 2015 kl. 12:42:29, skrev Marko Tiikkaja <marko@joh.to>:
On 5/27/15 12:39 PM, Jordan Gigov wrote:
> I found myself in need of triggers that are run only once per transaction,
> rather than per row or statement within the transaction. Meaning it will
> always be deferred and never called twice for the same transaction.

What's the use case?
 
 
I've often needed this for stuff like:
 
UPDATE some_table SET col = 'foo' where id = 1;
UPDATE some_table SET col = 'bar' where id = 1;
 
I want the "on-tx"-trigger to only run once, and on the last update of "col" so that it sees 'bar'.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Triggers on transaction?
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.