Re: Bug #947: time(timenow()) Parse Error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: silvera(at)ngt-dev(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #947: time(timenow()) Parse Error
Date: 2003-04-17 03:28:46
Message-ID: 2959.1050550126@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)org writes:
> time(timenow()) Parse Error

The syntax time(something) is now taken as a type name per SQL spec.
You need to write this with explicit cast syntax, or else put quotes
around "time":

select now()::time;
select cast(now() as time);
select "time"(now());

Although I'm wondering whether you shouldn't just be using

select current_time;

Note that the variants with timenow() run into a similar problem, which
is that the "time"(abstime) function has got the same mistake
internally. I'm surprised no one noticed this for two whole releases...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Casey Allen Shobe 2003-04-17 08:23:05 Parethesis don't work correctly in where clause
Previous Message pgsql-bugs 2003-04-17 00:45:34 Bug #947: time(timenow()) Parse Error