Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 5F92CB6114B for ; Thu, 2 Jun 2011 11:10:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 02943-03 for ; Thu, 2 Jun 2011 14:10:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 5E17BB60D7C for ; Thu, 2 Jun 2011 11:10:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p52EA4J1014436; Thu, 2 Jun 2011 10:10:04 -0400 (EDT) To: "" 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 In-reply-to: <201106020253.p522r1eD076376@wwwmaster.postgresql.org> References: <201106020253.p522r1eD076376@wwwmaster.postgresql.org> Comments: In-reply-to "" message dated "Thu, 02 Jun 2011 02:53:01 +0000" Date: Thu, 02 Jun 2011 10:10:04 -0400 Message-ID: <14435.1307023804@sss.pgh.pa.us> From: Tom Lane 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/16 X-Sequence-Number: 30395 "" writes: > 1). although i kown that, "the system will convert **now** to a timestamp as > soon as the constant is parsed", > i think this is a bug. Sorry, it's not a bug, and we're not going to change it. > but, what about "prepare p1 as select 'today'::timestamp"?? > today() is not a builtin function, we can't change it to "select > today()::timestamp"; You can get that by using date_trunc on the result of now(); or there's current_date, which is actually SQL-standard unlike these other things. regards, tom lane