Search Postgresql Archives

values from now() in the same transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I created a function with VOLATILE directive. it's
body looks like shown bellow

------------------------ cut start
begin
 insert into monitor(ts, c1) values(LOCALTIMESTAMP,
'Step 1000'); -- start time
 
 -- query below runs for 20min
 insert ito t1  select * from big_table
 

-- this timestamp should be bigger by 20min than start
time
 insert into monitor(ts, c1) values(LOCALTIMESTAMP,
'Step 1001');  end
----------------------- cut end

The value returned by LOCALTIMESTAMP function is the
same in both places despite that actual interval of 20
min between these calls.
I tried function now(),current_timestamp() but all of
them behave similar.

I don't believe that it's bug, probably it's a feature
of the postgreSql database.

Is any way to insert a timestamp within the same
transaction that would have current system time (not
time of the beginning of the transaction)?

With other words, I would like to see different
timestamps on first and last timestamp.

Thank you,
Vladimir



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux