Skip site navigation (1) Skip section navigation (2)

Re: BUG #6047: prepare p1 as select 'now'::timestamp; then "execute p1" many times, they return the same time

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "" <wcting163(at)163(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6047: prepare p1 as select 'now'::timestamp; then "execute p1" many times, they return the same time
Date: 2011-06-02 14:10:04
Message-ID: 14435.1307023804@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"" <wcting163(at)163(dot)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

In response to

pgsql-bugs by date

Next:From: Alexey KlyukinDate: 2011-06-02 15:04:29
Subject: Re: BUG #6048: TRUNCATE vs TRUNCATE CASCADE: misleading message
Previous:From: Peter EisentrautDate: 2011-06-02 12:09:45
Subject: Re: collation problem on 9.1-beta1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group