Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 4464865A9DB for ; Wed, 19 May 2010 09:27:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 55525-06 for ; Wed, 19 May 2010 12:27:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mh5.mail.rice.edu (mh5.mail.rice.edu [128.42.199.32]) by mail.postgresql.org (Postfix) with ESMTP id 1FA9165A9E0 for ; Wed, 19 May 2010 09:27:17 -0300 (ADT) Received: from mh5.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh5.mail.rice.edu (Postfix) with ESMTP id 8EEE615C00E; Wed, 19 May 2010 07:27:15 -0500 (CDT) X-Virus-Scanned: by amavis-2.6.0 at mh5.mail.rice.edu Received: from mh5.mail.rice.edu ([127.0.0.1]) by mh5.mail.rice.edu (mh5.mail.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Js-Ng6ZgxiPC; Wed, 19 May 2010 07:27:15 -0500 (CDT) Received: from aart.is.rice.edu (aart.is.rice.edu [168.7.56.48]) by mh5.mail.rice.edu (Postfix) with ESMTP id 689AA15C00A; Wed, 19 May 2010 07:27:15 -0500 (CDT) Received: by aart.is.rice.edu (Postfix, from userid 18612) id 136082D5A6; Wed, 19 May 2010 07:27:15 -0500 (CDT) Date: Wed, 19 May 2010 07:27:14 -0500 From: Kenneth Marshall To: silly sad Cc: pgsql-sql@postgresql.org Subject: Re: How to get CURRENT_DATE in a pl/pgSQL function Message-ID: <20100519122714.GY3892@aart.is.rice.edu> References: <20100518190832.GQ3892@aart.is.rice.edu> <20100518192721.GS3892@aart.is.rice.edu> <4BF3A09F.9090906@bankir.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BF3A09F.9090906@bankir.ru> User-Agent: Mutt/1.5.16 (2007-06-09) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/89 X-Sequence-Number: 34137 On Wed, May 19, 2010 at 12:26:07PM +0400, silly sad wrote: > On 05/18/10 23:27, Kenneth Marshall wrote: > >> It works using 'now' and I assume that since curtime is > > now() is NOT the CURRENT timestamp in fact, > it is about the timestamp of the current transaction has been started. > > it is the really USEFUL value, still u have to remember this meaning. > That is a good point. My main concern was locking the value to to point when the pl/pgSQL function was called initially because of the prepare process. Any of these will work if assigned to a variable and not included directly in the SQL statement. Cheers, Ken