pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Jonathan S. Katz <jonathan.katz@excoventures.com>
To: ng <pipelines@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: PGsql function timestamp issue
Date: Thu, 29 May 2014 16:52:32 -0400
Message-ID: <A7B82A97-96B4-4ED2-8F2E-FDED9C6F19EC@excoventures.com> (raw)
In-Reply-To: <CAAQKod115J-w7hiJ+rG8kn2FVqW51+ZVJsVpELNcU1Q4cw69dQ@mail.gmail.com>
References: <CAAQKod115J-w7hiJ+rG8kn2FVqW51+ZVJsVpELNcU1Q4cw69dQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
On May 29, 2014, at 4:46 PM, ng <pipelines@gmail.com> wrote:
> create or replace function dw.fx_nish()
> returns text
> language plpgsql
> as
> $$
> declare
> x timestamp with time zone;
> y timestamp with time zone;
> begin
> x:= current_timestamp;
> perform pg_sleep(5);
> y:= current_timestamp;
> if x=y then
> return 'SAME';
> else
> return 'DIFFERENT';
> end if;
>
> end;
> $$
>
>
> select dw.fx_nish()
> This give me 'SAME'
>
> Any work around for this?
Check out the Current Date/Time section:
http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
You probably want "clock_timestamp()" depending on what you are trying to accomplish.
Jonathan=
view thread (5+ messages) latest in thread
Message-ID: <A7B82A97-96B4-4ED2-8F2E-FDED9C6F19EC@excoventures.com>
Permalink: ../A7B82A97-96B4-4ED2-8F2E-FDED9C6F19EC@excoventures.com/
Also on: postgresql.org/message-id/A7B82A97-96B4-4ED2-8F2E-FDED9C6F19EC@excoventures.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jonathan.katz@excoventures.com, pipelines@gmail.com
Subject: Re: PGsql function timestamp issue
In-Reply-To: <A7B82A97-96B4-4ED2-8F2E-FDED9C6F19EC@excoventures.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox