Re: Date style handling changes between 7.4.12 and 8.2.4 - Mailing list pgsql-general

From Michael Nolan
Subject Re: Date style handling changes between 7.4.12 and 8.2.4
Date
Msg-id 4abad0eb0706121925i45b81b9dx6564b9dd35a2903e@mail.gmail.com
Whole thread Raw
In response to Date style handling changes between 7.4.12 and 8.2.4  (Adam Witney <awitney@sgul.ac.uk>)
List pgsql-general
What year would your example choose? 

The following works in 8.2.4:

select 'Wed Jul 11 2007 10:51:14 GMT+01:00'::timestamp with time zone
     timestamptz
------------------------
2007-07-11 06:51:14-05

It appears to ignore the day of the week, though:

select 'Mon Jul 11 2007 10:51:14 GMT+01:00'::timestamp with time zone

     timestamptz
------------------------
2007-07-11 06:51:14-05
--
Mike Nolan





On 6/12/07, Adam Witney <awitney@sgul.ac.uk > wrote:

Hi,

I am upgrading from 7.4.12 to 8.2.4 and I have run into a difference in date
style handling...

In 7.4.12 this would work

bugasbase2=# create table date_test (name date);
CREATE TABLE
bugasbase2=# insert into date_test values('Wed Jul 11 10:51:14 GMT+01:00
2001');

However in 8.2.4 this happens

bugasbase_070529=# create table date_test (name date);
CREATE TABLE
bugasbase_070529=# insert into date_test values('Wed Jul 11 10:51:14
GMT+01:00 2001');
ERROR:  invalid input syntax for type date: "Wed Jul 11 10:51:14 GMT+01:00
2001"

I assume something to do with date handling has changed?

I have found date_trunc and extract in the docs, but can't seem to get the
syntax right to get this to work... Is there a function that can convert the
string to be acceptable for 8.2.4?

Thanks in advance

adam



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

pgsql-general by date:

Previous
From: Erwin Brandstetter
Date:
Subject: Re: Join field values
Next
From: "Andrus"
Date:
Subject: Re: how to speed up query