Call Postgres function from Linked Server

From: "Jeff Crumbley" <jeffc(at)iilogistics(dot)com>
To: <pgsql-odbc(at)postgresql(dot)org>
Subject: Call Postgres function from Linked Server
Date: 2008-04-17 14:51:07
Message-ID: 58748158EFB67344819B48564FCAD4A808119BBE@exchange2.iilogistics.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-odbc by date

  From Date Subject
Next Message Jeremy Faith 2008-04-18 15:59:57 SQLBulkOperations Segfault
Previous Message Hiroshi Saito 2008-04-16 21:58:04 Re: Linked Server Error