values from now() in the same transaction

Поиск
Список
Период
Сортировка
От Vladimir Zelinski
Тема values from now() in the same transaction
Дата
Msg-id 194565.67156.qm@web52708.mail.yahoo.com
обсуждение исходный текст
Ответы Re: values from now() in the same transaction  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-general
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


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

Предыдущее
От: "Ian Harding"
Дата:
Сообщение: Re: requests / suggestions to help with backups
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: values from now() in the same transaction