Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XAbLS-0007eD-DE for pgsql-sql@arkaria.postgresql.org; Fri, 25 Jul 2014 08:59:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XAbLR-0007RR-Ot for pgsql-sql@arkaria.postgresql.org; Fri, 25 Jul 2014 08:59:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAbLQ-0007RK-NR for pgsql-sql@postgresql.org; Fri, 25 Jul 2014 08:59:16 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XAbLN-0000K8-9t for pgsql-sql@postgresql.org; Fri, 25 Jul 2014 08:59:14 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1XAbLM-0004Ei-91 for pgsql-sql@postgresql.org; Fri, 25 Jul 2014 01:59:12 -0700 Date: Fri, 25 Jul 2014 01:59:12 -0700 (PDT) From: Vinayak Pokale To: pgsql-sql@postgresql.org Message-ID: <1406278752273-5812825.post@n5.nabble.com> In-Reply-To: References: Subject: Re: PGsql function timestamp issue MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 3.5 (+++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Hello, The current_timestamp return the constant value in a transaction. So use clock_timestamp(). Example: create or replace function fx_nish() returns text language plpgsql as $$ declare x timestamp with time zone; y timestamp with time zone; begin x:= clock_timestamp(); perform pg_sleep(5); y:= clock_timestamp(); if x=y then return 'SAME'; else return 'DIFFERENT'; end if; end; $$ ; postgres=# select fx_nish(); fx_nish ----------- DIFFERENT (1 row) ----- Thanks and Regards, Vinayak Pokale, NTT DATA OSS Center Pune, India -- View this message in context: http://postgresql.1045698.n5.nabble.com/PGsql-function-timestamp-issue-tp5805486p5812825.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql