Re: How to check whether the row was modified by this transaction before?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to check whether the row was modified by this transaction before?
Дата
Msg-id 6067.1354816426@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How to check whether the row was modified by this transaction before?  (Vlad Arkhipov <arhipov@dc.baikal.ru>)
Ответы Re: How to check whether the row was modified by this transaction before?
Re: How to check whether the row was modified by this transaction before?
Список pgsql-hackers
Vlad Arkhipov <arhipov@dc.baikal.ru> writes:
> In a BEFORE UPDATE trigger I need to know whether the row was previously 
> modified by this transaction. Is it safe to use xmin and txid_current() 
> for this purpose (xmin is 32-bit txid type but txid_current() returns 
> 64-bit bigint).

>    IF OLD.xmin = txid_current() THEN

Comparing to txid_current() mod 2^32 would probably work, but note this
will not think that subtransactions or parent transactions are "this
transaction", so any use of savepoints or plpgsql exception blocks is
likely to cause headaches.  Why do you think you need to know this?
        regards, tom lane



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: How to check whether the row was modified by this transaction before?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Fix for pg_upgrade status display