Do not understand "SETOF RECORD" - therefore can not use ODBC-link - Mailing list pgsql-sql

From Harrie Rodenbach
Subject Do not understand "SETOF RECORD" - therefore can not use ODBC-link
Date
Msg-id AANLkTiklp-KIa3BSvnVmHWMQFd7fgnYeviSxo1RoQa3W@mail.gmail.com
Whole thread Raw
Responses Re: Do not understand "SETOF RECORD" - therefore can not use ODBC-link  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hi,

We are trying to make use of module ODBC-link. We follow the
instructions as read in README.TXT, including the given examples.
Connecting to an external Oracle database is successful: =  oratest=#
select odbclink.connect('ONT_KIS', 'sbm_beheer', 'password');
=   connect
=  ---------
=         1
=  (1 row)

Then we try to select some data:
=  oratest=# select odbclink.query(1, 'SELECT * FROM mytable') as
result(id int4, t text, d decimal); =  ERROR:  syntax error at or near
"(" =  LINE 1: ...bclink.query(1, 'SELECT * FROM mytable') as
result(id int4, ...
=                                                               ^

For some reason "as result(" generates the error. ODBC-link README.TXT
reads: =  All three forms of the function odbclink.query() returns
"SETOF RECORD", so =  1. it can return different query results =  2.
it must be properly casted to the expected result structure

The ODBC connection seems to work, when I select without using the "as
result"-part, I get another error message. =  oratest=# select
odbclink.query(1, 'SELECT * FROM mytable'); =  ERROR:  function
returning record called in context that cannot accept type record

So it seems the functions returns data, but I do not know how to
display it. Since I do not understand how to handle SETOF RECORD I can
not solve the problem myself.

We're running PostgreSQL 8.4.3, ODBC-link 1.0.

Any help will be highly appreciated.

TIA,

Harrie Rodenbach


--
--
Met vriendelijke groet / with kind regards,

Harrie Rodenbach


pgsql-sql by date:

Previous
From: "Good, Thomas"
Date:
Subject: Question about slow queries...
Next
From: James Kitambara
Date:
Subject: Fw: Re: help