Re: Freezing localtimestamp and other time function on some value - Mailing list pgsql-general

From Petr Korobeinikov
Subject Re: Freezing localtimestamp and other time function on some value
Date
Msg-id CAJL5ff9pVuE9cwuHod+iZtr3X57yUnrMW9ZYVzBaB7drOwmcXQ@mail.gmail.com
Whole thread Raw
In response to Re: Freezing localtimestamp and other time function on some value  (Pavel Stehule <pavel.stehule@gmail.com>)
List 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 by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Freezing localtimestamp and other time function on some value
Next
From: Rakesh Kumar
Date:
Subject: Re: Freezing localtimestamp and other time function on some value