Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 4086F154C060 for ; Sun, 15 Jul 2012 02:02:31 -0300 (ADT) Received: from capsaicin.mamane.lu ([2001:888:19f0:2:2e0:81ff:fe54:abf9]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SqGyT-0001PW-5B for pgsql-odbc@postgresql.org; Sun, 15 Jul 2012 05:02:30 +0000 Received: from master by capsaicin.mamane.lu with local (Exim 4.74) (envelope-from ) id 1SqGyB-0001Uf-Cv; Sun, 15 Jul 2012 07:02:11 +0200 Date: Sun, 15 Jul 2012 07:02:11 +0200 From: Lionel Elie Mamane To: Hiroshi Inoue Cc: Terrence Enger , pgsql-odbc@postgresql.org Subject: Re: segfault in SQLSpecialColumns when table name is null string Message-ID: <20120715050211.GA4207@capsaicin.mamane.lu> References: <1341922972.25065.19.camel@cougar-natty> <20120710142707.GB26793@capsaicin.mamane.lu> <5001E9A3.6070707@tpf.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5001E9A3.6070707@tpf.co.jp> X-Operating-System: GNU/Linux X-Request-PGP: http://www.mamane.lu/openpgp/rsa_v4_4096.asc User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/6 X-Sequence-Number: 10900 On Sun, Jul 15, 2012 at 06:50:27AM +0900, Hiroshi Inoue wrote: > (2012/07/10 23:27), Lionel Elie Mamane wrote: >>> Working with PostgreSQL version 8.4.12-0ubuntu11.04 and with ODBC >>> driver versions 1:08.03.0200-1.2 (supplied with ubuntu-natty (11.04)) >>> and pgsqlodbc-09.01.0100 (built locally), I have managed to provoke a >>> segfault by calling SQLSpecialColumns with a null string for the table >>> name. This call is, of course, a strange thing to do, and I cannot >>> imagine any good result. Still, a segfault seems a disproportionate >>> punishment for doing something silly. >> Also, the ultimate reason for this "strange thing" is that >> SQLColAttribute( (SQLHANDLE) 0x1ec7850, >> (SQLUSMALLINT) 1, >> (SQLUSMALLINT) 15, >> (SQLPOINTER) 0x1eb2640, >> 128, >> (SQLSMALLINT *) 0x7fffffff97de, >> NULL); >> where 15 == SQL_DESC_TABLE_NAME == SQL_COLUMN_TABLE_NAME >> returns (writes at 0x1eb2640) an empty string for this query: >> SELECT "Num" "Numero", "data" FROM "foo"."Table1" > What is your environment e.g. the version of your PG server > or the version of your psqlodbc? On Debian GNU/Linux amd64, Debian packages. Client: unixodbc 2.2.14p2-5 psqlodbc 09.01.0100 libpq5 9.1.3 Server: postgresql 9.0.6 Terrence is getting the same problem with (on Ubunty Natty 11.04): unixodbc 2.2.14p2-2ubuntu1 postgresql 8.4.12-0ubuntu11.04 odbc-postgresql 1:08.03.0200-1.2 I haven't directly checked that SQLColAttribute returns an empty string on Terrence's system, but since LibreOffice crashes in the same conditions, I presume the cause is the same than on my system, i.e. SQLColAttribute returns an empty string. -- Lionel