Re: Freezing localtimestamp and other time function on some value

From: Petr Korobeinikov <pkorobeinikov(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Freezing localtimestamp and other time function on some value
Date: 2016-04-12 12:11:27
Message-ID: CAJL5ff9pVuE9cwuHod+iZtr3X57yUnrMW9ZYVzBaB7drOwmcXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
```

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rakesh Kumar 2016-04-12 12:13:16 Re: Freezing localtimestamp and other time function on some value
Previous Message Pavel Stehule 2016-04-12 11:47:55 Re: Freezing localtimestamp and other time function on some value