X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 6DDBC11F628C for ; Wed, 26 Apr 2006 14:25:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 57405-06 for ; Wed, 26 Apr 2006 14:25:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pgfoundry.org (pgfoundry.org [200.46.204.130]) by postgresql.org (Postfix) with ESMTP id 51B9C11F60E3 for ; Wed, 26 Apr 2006 14:25:03 -0300 (ADT) Received: from localhost (mx1.hub.org [200.46.208.251]) by pgfoundry.org (Postfix) with ESMTP id 91D1986C4EA; Wed, 26 Apr 2006 17:25:03 +0000 (UTC) Received: from pgfoundry.org ([200.46.204.130]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 59117-01; Wed, 26 Apr 2006 14:24:49 -0300 (ADT) Received: by pgfoundry.org (Postfix, from userid 80) id 47A2C86C4EC; Wed, 26 Apr 2006 17:24:48 +0000 (UTC) To: noreply@pgfoundry.org From: Subject: [ psqlodbc-Bugs-1000620 ] SQLStatistics returns UNKNOWN instead of real column names Content-type: text/plain; charset=UTF-8 Message-Id: <20060426172448.47A2C86C4EC@pgfoundry.org> Date: Wed, 26 Apr 2006 17:24:48 +0000 (UTC) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.27 tagged_above=0 required=5 tests=AWL, BAYES_00, NO_REAL_NAME, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL X-Spam-Level: X-Archive-Number: 200604/108 X-Sequence-Number: 7635 Bugs item #1000620, was opened at 26-04-2006 17:24 You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000620&group_id=1000125 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: SQLStatistics returns UNKNOWN instead of real column names Initial Comment: Created By: den intech.ru Description: STEPS TO REPRODUCE 1. CREATE TABLE temp_table (a int) 2. ALTER TABLE temp_table DROP COLUMN a 3. ALTER TABLE temp_table ADD COLUMN a int 4. CREATE INDEX temp_index ON temp_table (a) CAUSE OF FAILURE Source code has a petty hole based on the erroneous interpretation of the column index stored in the pg_index.indkey. In this case the column index is not a sequence number of column, but value of the pg_attribute.attnum. Listing of source code: info.c (psqlodbc-08.00.0102) .... 2824 if (fields_vector[i] == OID_ATTNUM) 2825 { 2826 set_tuplefield_string(&row->tuple[8], "oid"); 2827 mylog("%s: column name = oid\n", func); 2828 } ->2829 else if (fields_vector[i] < 0 || fields_vector[i] > total_columns) 2830 { 2831 set_tuplefield_string(&row->tuple[8], "UNKNOWN"); 2832 mylog("%s: column name = UNKNOWN\n", func); 2833 } 2834 else 2835 { ->2836 set_tuplefield_string(&row->tuple[8], column_names[fields_vector[i] - 1]); 2837 mylog("%s: column name = '%s'\n", func, column_names[fields_vector[i] - 1]); 2838 } ... ---------------------------------------------------------------------- You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000620&group_id=1000125