Re: 9.2 timestamp function syntax error - Mailing list pgsql-general

From Adrian Klaver
Subject Re: 9.2 timestamp function syntax error
Date
Msg-id 513600A6.1020505@gmail.com
Whole thread Raw
In response to Re: 9.2 timestamp function syntax error  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Responses Re: 9.2 timestamp function syntax error
List 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.klaver@gmail.com


pgsql-general by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: [HACKERS] Floating point error
Next
From: Heikki Linnakangas
Date:
Subject: Re: [HACKERS] Floating point error