I was able to build the TDS_FDW and bring the extension into Postgresql 10. However, I'm getting the unusual message that it fails with a message of "Success".
ERROR: DB-Library error: DB #: 20002, DB Msg: Adaptive Server connection failed (secsql1.secdev.local:1433), OS #: 0, OS Msg: Success, Level: 9
SQL state: HV00L
The code generating the error is:
CREATE EXTENSION tds_fdw;
-- DROP SERVER mssql_acudb_server;
CREATE SERVER mssql_acudb_server
FOREIGN DATA WRAPPER tds_fdw
OPTIONS (servername 'wwww', port '1433', database 'AcuDB');
ALTER SERVER mssql_acudb_server
OPTIONS (ADD msg_handler 'notice');
-- DROP USER MAPPING FOR postgres SERVER mssql_acudb_server;
CREATE USER MAPPING FOR postgres
SERVER mssql_acudb_server
OPTIONS (username 'xxxx\yyyy', password 'zzzz');
-- DROP FOREIGN TABLE acudb_project;
CREATE FOREIGN TABLE acudb_project (
id BIGINT NOT NULL,
"name" TEXT NOT NULL,
path_prefix TEXT NOT NULL,
"type" TEXT NOT NULL,
sec_active_size BIGINT NULL
)
SERVER mssql_acudb_server
OPTIONS (query 'SELECT [id],[name],[path_prefix],[type],[sec_active_size]
FROM [projects]');
SELECT * FROM acudb_project
Was able to fix this issue by specifying the version of freeTDS in the "CREATE SERVER" statement:
-- DROP SERVER mssql_acudb_server;
CREATE SERVER mssql_acudb_server
FOREIGN DATA WRAPPER tds_fdw
OPTIONS (servername 'www', port '1433', database 'AcuDB', tds_version '7.1');