tds_fdw
tds_fdw copied to clipboard
Incorrect datetime value
The query below from MS SQL SMS
select a_date from dbo.test;
shows
2009-11-26 16:42:38.937
2008-05-16 17:29:08.397
(The column a_date defined as datetime in MS SQL.)
But the query
select a_date from my.ft_test;
from foreign table of PG SQL shows
2009-11-26 16:42:38.937
2008-05-16 18:29:08.397
This column in foreign table defined as timestamp without time zone. Foreign table is defined like this: CREATE FOREIGN TABLE my.ft_test ( ... a_date timestamp without time zone, ... ) SERVER fs_ms_sql OPTIONS (table 'dbo.test');
It looks like Postgres is applying Daylight savings time for some reason :/
Hi Rentechpro, May I know how you resolved the issue.
I too had a similar issue. In my case, tds_fdw is adding +5:30 (IST) to the date and time fetched from MSSQL. I am also using "timestamp without time zone".
Cheers, Anil
Hello guys,
Did you find any solution to this? I'm facing the same issue..
Thanks in advance.
@rentechpro , @bikethis81, @anilv4, @tyrion01, can you recompile tds_fdw with DEBUG enabled and show us both debug and postgres log when you run the queries (remove confidential parts if needed)?
Just change:
/* #define DEBUG */
to:
/* #define DEBUG */
At file src/tds_fdw.c
Maybe your freetds version could help as well.