Re: timestamp parse error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tomas Lehuta" <lharp(at)aurius(dot)sk>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: timestamp parse error
Date: 2002-09-20 15:19:30
Message-ID: 16439.1032535170@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

"Tomas Lehuta" <lharp(at)aurius(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-09-20 15:32:23 Re: Data Dump Issue
Previous Message Tom Lane 2002-09-20 14:43:48 Re: BYTEA

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-09-20 15:21:55 Re: Current CVS is broken
Previous Message Stephan Szabo 2002-09-20 15:10:19 Re: Win32 rename()/unlink() questions

Browse pgsql-sql by date

  From Date Subject
Next Message Aaron Held 2002-09-20 15:34:27 Monitoring a Query
Previous Message Stephan Szabo 2002-09-20 15:09:22 Re: query concat