Bug #605: timestamp(timestamp('a timestamp)) no longer works - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #605: timestamp(timestamp('a timestamp)) no longer works
Date
Msg-id 20020301095026.30D4947545D@postgresql.org
Whole thread Raw
Responses Re: Bug #605: timestamp(timestamp('a timestamp)) no longer works
List pgsql-bugs
Andrew McMillan (andrew@catalyst.net.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
afterme :-)
 


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

pgsql-bugs by date:

Previous
From: Reinhard Max
Date:
Subject: Re: Indexes not always used after inserts/updates/vacuum
Next
From: UltraMax
Date:
Subject: cannot install postgresql 7.2