Re: [GENERAL] timestamp parse error - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [GENERAL] timestamp parse error
Date
Msg-id 16439.1032535170@sss.pgh.pa.us
Whole thread Raw
In response to timestamp parse error  ("Tomas Lehuta" <lharp@aurius.sk>)
List pgsql-hackers
"Tomas Lehuta" <lharp@aurius.sk> writes:
> could somebody tell me what's wrong with this timestamp query example?

> select timestamp(date '1998-02-24', time '23:07')
> PostgreSQL said: ERROR: parser: parse error at or near "date"

> example is from PostgreSQL help

From where exactly?  I don't see any such example in current sources.

Although you could make this work by double-quoting the name "timestamp"
(which is a reserved word now, per SQL spec), I'd recommend sidestepping
the problem by using the equivalent + operator instead:

regression=# select "timestamp"(date '1998-02-24', time '23:07');
      timestamp
---------------------
 1998-02-24 23:07:00
(1 row)

regression=# select date '1998-02-24' + time '23:07';
      ?column?
---------------------
 1998-02-24 23:07:00
(1 row)


            regards, tom lane

pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Win32 rename()/unlink() questions
Next
From: Bruce Momjian
Date:
Subject: Re: Current CVS is broken