Re: Freezing localtimestamp and other time function on some value

From: Petr Korobeinikov <pkorobeinikov(at)gmail(dot)com>
To: Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Freezing localtimestamp and other time function on some value
Date: 2016-04-12 11:31:59
Message-ID: CAJL5ff9Jk7iV5veaMLHF=c1VGH9xDujxDER7YPPoutBNMgX50Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-04-12 13:50 GMT+03:00 Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>:

> Hello!
> Is there any method to freeze localtimestamp and other time function value.
> Say after freezing on some value sequential calls to these functions give
> you the same value over and over again.
> This is useful primarily for testing.
>

Hello!

I hope, the following snippet will be helpful.
```
begin;
select now(), current_timestamp, clock_timestamp();
select pg_sleep(5);
select now(), current_timestamp, clock_timestamp();
commit;
```

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2016-04-12 11:47:55 Re: Freezing localtimestamp and other time function on some value
Previous Message Alex Ignatov 2016-04-12 10:50:11 Freezing localtimestamp and other time function on some value