Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-hackers by date

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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group