Re: 9.2 timestamp function syntax error

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: Guy Rouillier *EXTERN* <guy(dot)rouillier(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: 9.2 timestamp function syntax error
Date: 2013-03-05 14:26:46
Message-ID: 513600A6.1020505@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/05/2013 12:30 AM, Albe Laurenz wrote:
> Guy Rouillier wrote:
>> I don't understand the error resulting from the following progression on
>> 9.2 (specifically "EnterpriseDB 9.2.1.3 on x86_64-unknown-linux-gnu,
>> compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52), 64-bit"):
>>
>> select sysdate => timestamp without time zone
>>
>> select timestamptz(sysdate) => timestamp with time zone
>>
>> select timestamp(timestamptz(sysdate)) => ERROR: syntax error at or
>> near "timestamptz"
>>
>> OR
>>
>> select timestamp(sysdate::timestamptz)) => ERROR: syntax error at or
>> near "sysdate"
>>
>> I see a function in pg_catalog with signature timestamp(timestamp with
>> time zone). Why isn't it being applied?
>
> That must be EnterpriseDB's proprietary Postgres Plus, since
> regular PostgreSQL doesn't have "sysdate".

Actually that is not the issue.

test=> select version();
version

----------------------
PostgreSQL 9.2.3

This does not work:

test=> select timestamp(now()::timestampz);
ERROR: syntax error at or near "now"
LINE 1: select timestamp(now()::timestampz);

test=> select timestamp(now());
ERROR: syntax error at or near "now"
LINE 1: select timestamp(now());

This does:

test=> select (now()::timestamptz)::timestamp;
now
----------------------------
2013-03-05 06:23:05.169524
(1 row)

test=> select now()::timestamp;
now
---------------------------
2013-03-05 06:24:43.50932
(1 row)

>
> Try to ask EnterpriseDB, they are more likely to be able to help.
>
> Yours,
> Laurenz Albe
>
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Heikki Linnakangas 2013-03-05 14:32:41 Re: [GENERAL] Floating point error
Previous Message Kevin Grittner 2013-03-05 13:59:26 Re: [GENERAL] Floating point error