pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
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
Date: Thu, 02 Jun 2011 10:10:04 -0400
Message-ID: <14435.1307023804@sss.pgh.pa.us> (raw)
In-Reply-To: <201106020253.p522r1eD076376@wwwmaster.postgresql.org>
References: <201106020253.p522r1eD076376@wwwmaster.postgresql.org>

"" <wcting163@163.com> 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



view thread (3+ messages)

Message-ID: <14435.1307023804@sss.pgh.pa.us>
Permalink:  ../14435.1307023804@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14435.1307023804@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wcting163@163.com
  Subject: Re: BUG #6047: prepare p1 as select 'now'::timestamp; then "execute p1" many times, they return the same time
  In-Reply-To: <14435.1307023804@sss.pgh.pa.us>
  References: <201106020253.p522r1eD076376@wwwmaster.postgresql.org> <14435.1307023804@sss.pgh.pa.us>

* 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