Thread: Bug #947: time(timenow()) Parse Error
Aaron Silver (silvera@ngt-dev.com) reports a bug with a severity of 3 The lower the number the more severe it is. Short Description time(timenow()) Parse Error Long Description In using Postgres 7.2.2 on a client's system I received a parse error using time(timenow()). Either in a function or viaa command-line "select time(timenow());" statement, I received a "parse error near timenow". A "select date(timenow());"worked fine. Doing "select time('2003-04-15 00:00:00');" worked fine also. This was not an issue on a machine running Postgres 7.1.3. Is/was this a known issue? Is there a patch, or in what release was this fixed? Aaron Sample Code No file was uploaded with this report
pgsql-bugs@postgresql.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