ECPG date output depends on database datestyle - Mailing list pgsql-novice

From Mark Smith
Subject ECPG date output depends on database datestyle
Date
Msg-id AANLkTi=BKqEc7=vKB+AqRD13-Lye4qwUbAt=CWL=Z4yT@mail.gmail.com
Whole thread Raw
List pgsql-novice
Hi all,
 
I am using ECPG with PostgreSQL 9.0.2. I have datestyle set in the postgresql.conf to be 'SQL, DMY' and I get unexpected (to me :) ) results selecting dates from the database into a variable of type 'date'.
 
For example, the date 05/08/2010 selected into a date variable is output as 3780 which corresponds to 08/05/2010.
 
The same program which returns the date as 3780 correctly returns '8' from 'select extract(month from mydatefield) ...' and all other queries show that the database understands the date to be 05/08/2010 (5th August 2010).
 
If I change datestyle to 'SQL, MDY' and restart the engine, the date is output correctly as 3869 and all other operations are consistent.
 
If the date has no possible ambiguity (e.g. 22/08/2010) it is output correctly regardless of the datestyle setting.
 
I didn't read anything in the docs to suggest that this is expected behaviour but I would be grateful is someone could point me in the right direction.
 
Thanks,
Mark

pgsql-novice by date:

Previous
From: Josh Kupershmidt
Date:
Subject: Re: Question about object renaming in 9.0 (release note doc.)
Next
From: Basil Bourque
Date:
Subject: How to detect if in transaction?