Call Postgres function from Linked Server - Mailing list pgsql-odbc

From Jeff Crumbley
Subject Call Postgres function from Linked Server
Date
Msg-id 58748158EFB67344819B48564FCAD4A808119BBE@exchange2.iilogistics.com
Whole thread Raw
List pgsql-odbc

Not to be repetitive but I think my approach on this has changed from yesterday.

 

Using the Postgres ODBC driver (psqlodbc_08_03_0100) on windows, how do I pass the command to execute a Function on another machine? 

 

I am currently trying to execute the Function directly from SQL Server Query Manager like this “EXEC [PostgreSQL].dta.testuser.mssql_test” but get an error stating:

 

OLE DB provider "MSDASQL" for linked server "PostgreSQL" returned message "ERROR: syntax error at or near "1";

Error while executing the query".

Msg 7212, Level 17, State 1, Line 1

Could not execute procedure 'mssql_test' on remote server 'PostgreSQL'.

 

After corresponding with Hiroshi yesterday I now understand that the error is due to SQL Server trying to interpret the function call before it is handed off to ODBC, resulting in the error.

 

As a potential fix I thought using OPENQUERY might work but I don’t know the equivalent syntax to “EXEC [PostgreSQL].dta.testuser.mssql_test” to use to call a Function using OPENQUERY.

 

Any help anyone can provide would be appreciated.

 

Thanks,

 

JeffCrumble

 

pgsql-odbc by date:

Previous
From: "Hiroshi Saito"
Date:
Subject: Re: Linked Server Error
Next
From: Jeremy Faith
Date:
Subject: SQLBulkOperations Segfault