From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | "Warstone(at)list(dot)ru" <warstone(at)list(dot)ru>, "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Is there a way to change current time? |
Date: | 2021-04-15 14:01:56 |
Message-ID: | 20210415140155.GJ6091@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Thu, Apr 15, 2021 at 09:58:23AM -0400, Bruce Momjian wrote:
> On Thu, Apr 15, 2021 at 04:45:44PM +0300, Warstone(at)list(dot)ru wrote:
> > Hi,
> >
> > Is there any way to set time that CURRENT_TIMESTAMP and/or now() will give next
> > time? (We need it only for testing purposes so if there is any hack, cheat,
> > etc. It will be fine)
>
> No, it gets the time from the operating system.
You could overload now():
postgres=# CREATE DATABASE pryzbyj;
postgres=# \c pryzbyj
pryzbyj=# CREATE SCHEMA pryzbyj;
pryzbyj=# CREATE FUNCTION pryzbyj.now() RETURNS timestamp LANGUAGE SQL AS $$ SELECT 'today'::timestamp $$;
pryzbyj=# ALTER ROLE pryzbyj SET search_path=pryzbyj,public,pg_catalog;
pryzbyj=# SELECT now();
now | 2021-04-15 00:00:00
--
Justin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-04-15 14:13:33 | Re: Is there a way to change current time? |
Previous Message | Bruce Momjian | 2021-04-15 13:58:23 | Re: Is there a way to change current time? |