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

BUG #3511: timeofday()::timestamp failing on Saturday when using australian_timezones = on

From: "Adam" <adam(at)subdesigns(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3511: timeofday()::timestamp failing on Saturday when using australian_timezones = on
Date: 2007-08-04 08:48:58
Message-ID: 200708040848.l748mwh1054236@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      3511
Logged by:          Adam
Email address:      adam(at)subdesigns(dot)net
PostgreSQL version: 8.1.9
Operating system:   Debian etch, using postgresql-8.1:8.1.9-0etch1
Description:        timeofday()::timestamp failing on Saturday when using
australian_timezones = on
Details: 

Conversion to a timestamp is failing to decode a timeofday() date string
which has both 'Sat' and a timezone 'EST', when australian_timezones is
enabled.

date config is set as:
datestyle = 'iso, dmy'
australian_timezones = on

Following code details the conversion issue. Removal of the 'EST' timezone,
or changing to a different (even invalid) day does not result in an error.

erams=# select timeofday();
              timeofday
-------------------------------------
 Sat Aug 04 12:17:29.290100 2007 EST
(1 row)

erams=# select timeofday()::timestamp;
ERROR:  invalid input syntax for type timestamp: "Sat Aug 04 12:17:29.290100
2007 EST"
erams=# select 'Sat Aug 04 12:17:29.290100 2007 EST'::timestamp;
ERROR:  invalid input syntax for type timestamp: "Sat Aug 04 12:17:29.290100
2007 EST"
erams=# select 'Sun Aug 05 12:17:29.290100 2007 EST'::timestamp;
        timestamp
--------------------------
 2007-08-05 12:17:29.2901
(1 row)

erams=# select 'Sat Aug 11 12:17:29.290100 2007 EST'::timestamp;
ERROR:  invalid input syntax for type timestamp: "Sat Aug 11 12:17:29.290100
2007 EST"
erams=# select 'Sun Aug 11 12:17:29.290100 2007 EST'::timestamp;
        timestamp
--------------------------
 2007-08-11 12:17:29.2901
(1 row)

erams=# select 'Sat Aug 10 12:17:29.290100 2007 EST'::timestamp;
ERROR:  invalid input syntax for type timestamp: "Sat Aug 10 12:17:29.290100
2007 EST"
erams=# select 'Sat Aug 09 12:17:29.290100 2007 EST'::timestamp;
ERROR:  invalid input syntax for type timestamp: "Sat Aug 09 12:17:29.290100
2007 EST"
erams=# select 'Sat Aug 04 12:17:29.290100 2007'::timestamp;
        timestamp
--------------------------
 2007-08-04 12:17:29.2901
(1 row)

erams=# select 'Mon Aug 04 12:17:29.290100 2007 EST'::timestamp;
        timestamp
--------------------------
 2007-08-04 12:17:29.2901
(1 row)

Conversion to timestamptz also results in same issue:

erams=# select timeofday()::timestamptz;
ERROR:  invalid input syntax for type timestamp with time zone: "Sat Aug 04
12:52:47.381035 2007 EST"


Removal of the 'Sat' corrects the issue:
erams=# select substring(timeofday() from '^[^[:space:]]* (.*
[[:digit:]]{4})')::timestamp;
         substring
----------------------------
 2007-08-04 13:33:20.825623
(1 row)
 
erams=# select substring(timeofday() from '^[^[:space:]]* (.*
[[:digit:]]{4})')::timestamp::timestamptz
erams-# ;
           substring
-------------------------------
 2007-08-04 13:33:26.137588+10
(1 row)


Changing australian_timezones = off corrects the issue.

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2007-08-04 15:28:28
Subject: Re: BUG #3511: timeofday()::timestamp failing on Saturday when using australian_timezones = on
Previous:From: Peter KoczanDate: 2007-08-03 21:40:07
Subject: Re: BUG #3504: Some listening sessions never return from writing, problems ensue

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