Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 81A6D9FB2D4 for ; Fri, 27 Jul 2007 20:13:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 94519-04 for ; Fri, 27 Jul 2007 20:13:10 -0300 (ADT) X-Greylist: delayed 00:05:01.351467 by SQLgrey-1.7.5 Received: from alnrmhc11.comcast.net (alnrmhc11.comcast.net [204.127.225.91]) by postgresql.org (Postfix) with ESMTP id 03CA19FB1EB for ; Fri, 27 Jul 2007 20:13:14 -0300 (ADT) Received: from jeff.jeffandtilghman.com ([68.53.162.99]) by comcast.net (alnrmhc11) with ESMTP id <20070727230811b11000n3e3e>; Fri, 27 Jul 2007 23:08:12 +0000 Received: from vcch17.vcch (vcchgate.vcch01.springfield.tn.us.vcch.net [205.241.238.3]) by jeff.jeffandtilghman.com (8.13.5/8.13.5) with ESMTP id l6RN8Huv081023 for ; Fri, 27 Jul 2007 18:08:17 -0500 (CDT) From: Tilghman Lesher To: pgsql-odbc@postgresql.org Subject: Bug in SQLColumns Date: Fri, 27 Jul 2007 18:08:09 -0500 User-Agent: KMail/1.8.2 X-Message: If you didn't get the source, you paid too much. MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_ZrnqGBPtxFofs6O" Message-Id: <200707271808.09470.tilghman@mail.jeffandtilghman.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/60 X-Sequence-Number: 9115 --Boundary-00=_ZrnqGBPtxFofs6O Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline The specification for SQLColumns states: Column 16 CHAR_OCTET_LENGTH (INTEGER) Contains the maximum length in octets for a character data type column. For Single Byte character sets, this is the same as COLUMN_SIZE. For all other data types it is NULL. However, as currently implemented in psqlodbc-08.02.0300, it is always encoded as NULL. Patch attached. -- Tilghman --Boundary-00=_ZrnqGBPtxFofs6O Content-Type: text/plain; charset="us-ascii"; name="20070727__octet_length.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="20070727__octet_length.diff.txt" --- info.c.old 2007-07-27 18:04:07.000000000 -0500 +++ info.c 2007-07-27 18:04:16.000000000 -0500 @@ -2329,7 +2329,10 @@ set_tuplefield_null(&tuple[COLUMNS_COLUMN_DEF]); set_tuplefield_int2(&tuple[COLUMNS_SQL_DATA_TYPE], sqltype); set_tuplefield_null(&tuple[COLUMNS_SQL_DATETIME_SUB]); - set_tuplefield_null(&tuple[COLUMNS_CHAR_OCTET_LENGTH]); + if (the_type == PG_TYPE_CHAR || the_type == PG_TYPE_CHAR2 || the_type == PG_TYPE_CHAR4 || the_type == PG_TYPE_CHAR8 || the_type == PG_TYPE_NAME || the_type == PG_TYPE_BPCHAR || the_type == PG_TYPE_VARCHAR || the_type == PG_TYPE_TEXT || the_type == PG_TYPE_BYTEA || the_type == PG_TYPE_LO_UNDEFINED) + set_tuplefield_int4(&tuple[COLUMNS_CHAR_OCTET_LENGTH], pgtype_buffer_length(stmt, the_type, PG_STATIC, PG_STATIC)); + else + set_tuplefield_null(&tuple[COLUMNS_CHAR_OCTET_LENGTH]); set_tuplefield_int4(&tuple[COLUMNS_ORDINAL_POSITION], ordinal); set_tuplefield_string(&tuple[COLUMNS_IS_NULLABLE], "No"); #endif /* ODBCVER */ --Boundary-00=_ZrnqGBPtxFofs6O--