ECPG date output depends on database datestyle

Поиск
Список
Период
Сортировка
От Mark Smith
Тема ECPG date output depends on database datestyle
Дата
Msg-id AANLkTi=BKqEc7=vKB+AqRD13-Lye4qwUbAt=CWL=Z4yT@mail.gmail.com
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Josh Kupershmidt
Дата:
Сообщение: Re: Question about object renaming in 9.0 (release note doc.)
Следующее
От: Basil Bourque
Дата:
Сообщение: How to detect if in transaction?