1

我能够构建 TDS_FDW 并将扩展引入 Postgresql 10。但是,我收到异常消息,即它失败并显示“成功”消息。

ERROR: DB-Library error: DB #: 20002, DB Msg: Adaptive Server connection failed (secsql1.secdev.local:1433), OS #: 0, OS Msg: Success, Level: 9

SQL状态:HV00L

产生错误的代码是:

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
4

1 回答 1

0

能够通过在“CREATE SERVER”语句中指定 freeTDS 的版本来解决此问题:

-- 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');
于 2017-11-20T23:23:17.150 回答