Re: Freezing localtimestamp and other time function on some value

Поиск
Список
Период
Сортировка
От Petr Korobeinikov
Тема Re: Freezing localtimestamp and other time function on some value
Дата
Msg-id CAJL5ff9pVuE9cwuHod+iZtr3X57yUnrMW9ZYVzBaB7drOwmcXQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Freezing localtimestamp and other time function on some value  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
Sorry.
I have re-read my previous message.
It looks unclean.

For sequential calls in same transaction `now()` and `current_timestamp` will produce the same output.

```
begin; -- start a transaction

select
  now() immutable_now,
  current_timestamp immutable_current_ts,
  clock_timestamp() mutable_clock_ts;

select pg_sleep(1); -- wait a couple of time

select
  now() immutable_now, -- same as above
  current_timestamp immutable_current_ts, -- same as above
  clock_timestamp() mutable_clock_ts; -- value changed

select pg_sleep(1); -- wait a couple of time again

select
  now() immutable_now, -- same as above
  current_timestamp immutable_current_ts, -- same as above
  clock_timestamp() mutable_clock_ts; -- value changed

commit; -- commit or rollback
```

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Freezing localtimestamp and other time function on some value
Следующее
От: Rakesh Kumar
Дата:
Сообщение: Re: Freezing localtimestamp and other time function on some value