Bug #605: timestamp(timestamp('a timestamp)) no longer works

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #605: timestamp(timestamp('a timestamp)) no longer works
Date: 2002-03-01 09:50:26
Message-ID: 20020301095026.30D4947545D@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Andrew McMillan (andrew(at)catalyst(dot)net(dot)nz) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
timestamp(timestamp('a timestamp)) no longer works

Long Description
In version 7.2 it seems that I can't reduntantly cast value to timestamp if it is already a timestamp.

I do this reasonably often in my code by way of being paranoid that I might have a date, or a time, where I for sure _really_ want it to be a timestamp...

It's cleaning up some bugs in my code, I suppose, but I kind of like making it explicit to people who might come along after me :-)

Sample Code
Here's the broken query:

pcnz=# select timestamp('2002-03-01'::timestamp);
ERROR: parser: parse error at or near "'"
pcnz=# select version();
version
-------------------------------------------------------------
PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.95.4
(1 row)

I notice that int4(int4()) still works:

pcnz=# select int4( '777'::int4 );
int4
------
777
(1 row)

A couple of older versions where this worked:

pcnz=# select timestamp('2002-03-01'::timestamp);
timestamp
------------------------
2002-03-01 00:00:00+13
(1 row)

pcnz=# select version();
version
---------------------------------------------------------------
PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc 2.95.2
(1 row)

stimulus=# select timestamp('2002-03-01'::timestamp);
timestamp
------------------------
2002-03-01 00:00:00+13
(1 row)

stimulus=# select version();
version
---------------------------------------------------------------
PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.4
(1 row)

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message UltraMax 2002-03-01 10:26:25 cannot install postgresql 7.2
Previous Message Fouad Fezzi 2002-03-01 09:21:06 about catalogue tables bugs?

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak 2002-03-01 10:02:05 Re: Database Caching
Previous Message Karel Zak 2002-03-01 09:28:46 Re: Oracle vs PostgreSQL in real life