Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1A747B61DE1 for ; Thu, 2 Jun 2011 05:51:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 16272-02-2 for ; Thu, 2 Jun 2011 08:51:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id 6CD98B61B65 for ; Thu, 2 Jun 2011 05:51:24 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id 983B1134; Thu, 2 Jun 2011 04:51:23 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id EVmvMTkMbAwd; Thu, 2 Jun 2011 04:51:22 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id 68CDF2D; Thu, 2 Jun 2011 04:51:22 -0400 (EDT) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 546AFAE45E; Thu, 2 Jun 2011 16:51:21 +0800 (WST) Message-ID: <4DE74F09.8080404@postnewspapers.com.au> Date: Thu, 02 Jun 2011 16:51:21 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110307 Thunderbird/3.1.9 MIME-Version: 1.0 To: wcting163@163.com CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6047: prepare p1 as select 'now'::timestamp; then "execute p1" many times, they return the same time References: <201106020253.p522r1eD076376@wwwmaster.postgresql.org> In-Reply-To: <201106020253.p522r1eD076376@wwwmaster.postgresql.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/13 X-Sequence-Number: 30392 On 02/06/11 10:53, wcting163@163.com wrote: > but, what about "prepare p1 as select 'today'::timestamp"?? > today() is not a builtin function, we can't change it to "select > today()::timestamp"; The keyword-to-timestamp conversions are ugly historical hacks. Use the SQL-standard current_date, current_time, and current_timestamp keywords instead. http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT -- Craig Ringer