Re: Freezing localtimestamp and other time function on some value

From: Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, George Neuner <gneuner2(at)comcast(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Freezing localtimestamp and other time function on some value
Date: 2016-04-13 11:17:03
Message-ID: 570E2AAF.4060209@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12.04.2016 21:05, Tom Lane wrote:
> I wrote:
>> 3. While I can see the point of wanting to, say, test weekend behavior
>> on a weekday, I do not see how a value of now() that doesn't advance
>> between transactions would represent a realistic test environment for
>> an app with time-dependent behavior.
> BTW, one possible way of meeting that particular requirement is to fool
> with your timezone setting.
>
> regression=# select timeofday();
> timeofday
> -------------------------------------
> Tue Apr 12 14:01:53.254286 2016 EDT
> (1 row)
>
> regression=# set time zone interval '+120 hours';
> SET
> regression=# select timeofday();
> timeofday
> --------------------------------------
> Sun Apr 17 18:01:58.293623 2016 +120
> (1 row)
>
> regards, tom lane
>
>
Oh!
This is better than nothing =)!

--
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 Thomas Kellerer 2016-04-13 12:16:50 Why is the comparison between timestamp and date so much slower then between two dates
Previous Message Christoph Moench-Tegeder 2016-04-13 11:16:32 Re: Returning values from an array of JSONB objects.