Re: Freezing localtimestamp and other time function on some value

From: Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>
To: Rakesh Kumar <rakeshkumar464a3(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Freezing localtimestamp and other time function on some value
Date: 2016-04-12 12:27:02
Message-ID: 570CE996.30301@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12.04.2016 15:13, Rakesh Kumar wrote:
> I think PG does fixed time within a tran. check the output of the following sql
>
> begin;
> select now() ;
> select pg_sleep(10);
> select now() ;
> commit;
> select now() ;
> select pg_sleep(10);
> select now() ;
> ~
>
> On Tue, Apr 12, 2016 at 6:50 AM, Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru> wrote:
>> 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.
>>
>> In oracle there is alter system set fixed_date command. Have Postgres this
>> functionality?
>>
>> --
>> Alex Ignatov
>> Postgres Professional: http://www.postgrespro.com
>> The Russian Postgres Company
>>
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>
Hi!
It is not about localtimestamp in transactions. It is about global
localtimestamp value for all session new and existed no matter inside
transaction or outside.

--
Alex Ignatov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-04-12 13:50:27 Re: pgpool-II: cannot use serializable mode in a hot standby
Previous Message Rakesh Kumar 2016-04-12 12:13:16 Re: Freezing localtimestamp and other time function on some value