Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E28BF476E6B for ; Wed, 8 Jan 2003 12:34:43 -0500 (EST) Received: from haeb.noc.uk.easynet.net (haeb.noc.uk.easynet.net [195.40.7.191]) by postgresql.org (Postfix) with ESMTP id CF3DE476586 for ; Wed, 8 Jan 2003 12:33:42 -0500 (EST) Received: (from haeb@localhost) by haeb.noc.uk.easynet.net (8.9.3/8.9.1) id RAA72769 for pgsql-odbc@postgresql.org; Wed, 8 Jan 2003 17:33:47 GMT (envelope-from haeb) Message-Id: <200301081733.RAA72769@haeb.noc.uk.easynet.net> Subject: Problems with PGSQL ODBC drivers To: pgsql-odbc@postgresql.org Date: Wed, 8 Jan 2003 17:33:47 +0000 (GMT) From: Harry Broomhall Reply-To: "Harry Broomhall" X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/38 X-Sequence-Number: 2537 I posted this to the general newsgroup 'comp.databases.postgresql.questions' a little while ago, and got no takers! 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.