At 08:41 p.m. 6/02/2013, un_spoken wrote:

>I am wonder what will hapen in a such scenerio:
>
>I am updating 100 rows. In ON UPDATE Trigger of the first row I am reading 
>CURRENT_TRANSACTION and it gives me a number 1234. In the meantime some new 
>transactions happened on the database. For example 10 users made 10 select 
>queries thus resulting in 10 new transactions.
>
>I am stiil in my transaction and now I am updating row number 97. I am reading 
>CURRENT_TRANSACTION once again, what will be it's result? Will it be 1234 or 
>1244 (+10 transactions) ?
>
>In case of the latter this is no good for me. I would like to have a number of 
>a transaction in which I am in. Sorry if I wasn't precise last time :)

The purpose of transactions is to isolate the current task of the current user 
from all other transactions.  The CURRENT_TRANSACTION value for the transaction 
that reads it is that (and only that) isolated transaction. 

Note that if you have the same *user* updating multiple rows and your 
application commits after each row is updated then each update will be in a 
different transaction and CURRENT_TRANSACTION will be different each time.

./heLen

Reply via email to