Reputation: 13
I have a PostgreSQL database with datestyle set to "german,dmy" and it works fine on psql. However, when my application tries to retrieve dates from this database (using unixODBC driver) these dates "arrive" in "iso" style...
Could it be caused by driver? Is there something I should do on unixODBC in order to retrieve dates in the same format set to the database?
Thanks in advance.
Upvotes: 0
Views: 131
Reputation: 51609
you can try setting default datestyle for the user:
so=# alter user tt set datestyle to 'german,dmy';
ALTER ROLE
so=# select now();
now
-------------------------------
2017-04-24 21:33:53.653813+01
(1 row)
so=# show datestyle;
DateStyle
-----------
ISO, MDY
(1 row)
so=# \q
Now connect with user tt:
MacBook-Air:~ vao$ psql so -U tt
psql (9.6.1)
Type "help" for help.
so=> select now();
now
--------------------------------
24.04.2017 21:34:03.874708 IST
(1 row)
so=> show datestyle;
DateStyle
-------------
German, DMY
(1 row)
If it does not help, ODBC actively sets datestyle itself. If does, you have same in .psqlrc
for style German...
Also check the advanced tab of ODBC datasource
InitializationString=set datestyle to "german,dmy"
Upvotes: 1