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

ECPG date output depends on database datestyle

From: Mark Smith <marksmith(dot)smith175(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: ECPG date output depends on database datestyle
Date: 2011-01-18 18:17:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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


pgsql-novice by date

Next:From: Basil BourqueDate: 2011-01-18 20:52:46
Subject: How to detect if in transaction?
Previous:From: Josh KupershmidtDate: 2011-01-18 18:03:22
Subject: Re: Question about object renaming in 9.0 (release note doc.)

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