timeofday() and CAST - Mailing list pgsql-general

From Vilson farias
Subject timeofday() and CAST
Date
Msg-id 0db301c367e5$b888f160$98a0a8c0@dgtac
Whole thread Raw
Responses Re: timeofday() and CAST  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Greetings,

  I was executing some queries when I discovered that 7.3.4's CAST is a
little different from 7.1.2 when working with timestamps. When working with
localized timestamps, I can't use CAST to convert a string for a timestamp
anymore. Please take a look in the following scripts.

#### PostgreSQL 7.1.2 ####

bxs=# SELECT timeofday();
              timeofday
-------------------------------------
 Thu Aug 21 09:58:57.975598 2003 BRT
(1 row)

bxs=# SELECT CAST(timeofday() AS timestamp);
         ?column?
---------------------------
 2003-08-21 09:59:22.16-03
(1 row)


#### PostgreSQL 7.3.4 ####

bxs=# SELECT timeofday();
              timeofday
-------------------------------------
 Thu Aug 21 10:04:18.215420 2003 BRT
(1 row)

bxs=# SELECT CAST(timeofday() AS timestamp);
ERROR:  Bad timestamp external representation 'Thu Aug 21 10:04:42.597819
2003 BRT'
bxs=#

bxs=#  SELECT CAST('Thu Aug 21 10:04:27.203170 2003 BRT' AS timestamp);
ERROR:  Bad timestamp external representation 'Thu Aug 21 10:04:27.203170
2003 BRT'

bxs=#  SELECT CAST('Thu Aug 21 10:04:27.203170 2003' AS timestamp);
         timestamp
---------------------------
 2003-08-21 10:04:27.20317
(1 row)



Best regards

----------------------------------------------------------------------------
----
José Vilson de Mello de Farias
Software Engineer

Dígitro Tecnologia Ltda - www.digitro.com.br
APC - Customer Oriented Applications
E-mail: vilson.farias@digitro.com.br
Tel.: +55 48 281 7158
ICQ 11866179


pgsql-general by date:

Previous
From: "Philip Boonzaaier"
Date:
Subject: Re: Bulk Insert / Update / Delete
Next
From: Tom Lane
Date:
Subject: Re: query optimization: aggregate and distinct