Problems with PGSQL ODBC drivers

From: Harry Broomhall <harry(dot)broomhall(at)uk(dot)easynet(dot)net>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Problems with PGSQL ODBC drivers
Date: 2003-01-08 17:33:47
Message-ID: 200301081733.RAA72769@haeb.noc.uk.easynet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

I posted this to the general newsgroup
'comp.databases.postgresql.questions' a little while ago, and got no takers!

<grin>

As I am fairly sure this is a ODBC driver issue I am reposting it here,
somewhat ammended, in the hope of enlightenment.

===================================

I have run up against a problem trying to use the PostgreSQL ODBC
Windows driver, and wondered if anyone can point me in the right
direction.

Basics:

Server: PostgreSQL 7.2.1 on i386-unknown-freebsd4.5,
compiled by GCC 2.95.3

ODBC driver: PostgreSQL (not beta) 7.02.00.05

Windows: NT4 - SP 4

Excel 2000

I have a view on the server from which I wish to import data into
Excel, using MS Query.

If I type the SQL query direct into MSQuery it works fine, and the
data is fetched.

If I attempt to use the MSQuery 'wizard' then when I get to 'Finish'
and ask to return the data to Excel then I get an Error box with the
message: "Error: No such attribute or function 'oid'". This message
is echoed in the PostgreSQL logs.

I enabled the log files in the ODBC driver, and noticed that an
attribute 'oid' was added to the query that I would otherwise have
expected the MSQuery app to send. AFAIK views don't have oids, so it
would seem to me that the driver is misidentifying the view as a table
with oids?

Looking further at the logs, and going though the driver source, it
*looks* to me as if the code for the ODBC function SQLSpecialColumns
when called with IdentifierType = SQL_BEST_ROWID may be the culprit.

It *always* (AFAICT) returns oid for this call.

Looking through info.c I note the following:

There is a comment early in the function where it says 'Create the
query to find out if this is a view or not...', and fetches
pg_class.relhasrules. However in the code for SQLTables is the
comment 'view is represented by its relkind since 7.1'.

Any suggestions as to work-arounds, patches, or tests to try would
be welcomed.

========================

Regards,
Harry.

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Patrick Hatcher 2003-01-08 18:36:20 Unable to download from new site
Previous Message Tambet Matiisen 2003-01-08 10:42:11 ADO resync and views