Possible Typecasting Bug with coalesce()

From: "MotherMGA" <sbbowers(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Possible Typecasting Bug with coalesce()
Date: 2006-07-17 13:48:31
Message-ID: 1153144111.677727.24820@m79g2000cwm.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello everyone, I found something that struck me as odd revolving
around automatic typecasting and coalesce. It appears as though a
timestamp will not automatically be cast to a timestamp if the
timestamp is coalesced. Consider the following example:

=> select now()>'Jul 14 2006 9:16:47AM';
?column?
----------
t
(1 row)

=> select now()>coalesce('Jul 14 2006 9:16:47AM');
?column?
----------
f
(1 row)

=> select now()>coalesce('Jul 14 2006 9:16:47AM')::timestamp with time
zone;
?column?
----------
t
(1 row)

=> select now()>coalesce('Jul 14 2006 9:16:47AM'::timestamp with time
zone);
?column?
----------
t
(1 row)

Just wanted to know if anyone was aware of this behavior and if it is
correct.

Thanks,
Scott.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-07-17 14:16:16 Re: automatic system info tool?
Previous Message Andrew Dunstan 2006-07-17 13:08:54 Re: plPHP and plRuby