Open choucavalier opened 1 year ago
Hi, sorry for late reply. The library is using DB-library. From what I understand (I would need some debug output to make it sure) PG/tds_fdw is doing a select on MSSQL and converting DATETIMEOFFSET into string then trying to convert it back to PG TIMESTAMP. Simply PG is not accepting the string MSSQL/DB-library is using. You can probably change that format using locales.conf
, see https://www.freetds.org/userguide/locales.html.
Otherwise you can try a connector using ODBC instead of DB-library.
thank you so much @fziglio for your answer
this is exactly our analysis of what is happening as well
here's what our /etc/locales.conf
looks like:
[default]
date format = %b %e %Y %I:%M:%S:%z%p
[en_US]
date format = %b %e %Y %I:%M:%S:%z%p
language = us_english
charset = iso_1
[es_ES]
date format = %b %d %Y %I:%M%p
language = spanish
charset = iso_1
[pt_BR]
date format = %d/%m/%Y %H:%M
language = Portuguese
charset = iso_1
[it_IT]
date format = %d/%m/%Y %H:%M
language = Italiano
charset = iso_1
The question is also "how pg/tds_fdw expect dates to be formatted?"
I think some people have the same issue indeed
I think this might be the solution
I would try also something like %Y-%m-%d %H:%M:%S.%z
. Not sure what will happen to the time offset in this case.
Hello! First of all, thank you very much for the effort put into this open source project.
I am using https://github.com/tds-fdw/tds_fdw to query SQL Server tables in PostgreSQL. freetds is used as a backend in that context.
When querying tables with a datetimeoffset data type, I'm having an error, which I think is due to the string-conversion of
datetimeoffset
objects:The
MyTable
table is exposed as a Foreign Table like so:In the SQL Server database, the table has the following structure
With the following user-defined data types:
Is the
datetimeoffset
data type correctly supported by freetds?Is there anything that can be done to make the conversion of the data to correct PostgreSQL timezone-aware datetimes?
Thanks!