BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names

Lists: pgsql-bugs
From: "Andrei Badea" <andrei(dot)badea(at)sun(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names
Date: 2007-07-23 13:58:47
Message-ID: 200707231358.l6NDwlWh026230@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3480
Logged by: Andrei Badea
Email address: andrei(dot)badea(at)sun(dot)com
PostgreSQL version: 8.2.4
Operating system: Debian GNU/Linux testing/lenny, Linux 2.6.17
Description: JDBC driver: getIndexInfo() returns quotes around quoted
column names
Details:

JDBC3 driver 8.2-505 and JDBC4 driver 8.3dev-600.

The DatabaseMetaData.getIndexInfo() method returns quotes around quoted
column names, unlike the getColumns() method. To reproduce run the following
statement in a database named "test" and the "public" schema:

create table "CUSTOMER" ("CUSTOMER_ID" int not null primary key);

connect to the database and execute the following code:

// java.sql.Connection conn
DatabaseMetaData dmd = conn.getMetaData();
// print the columns
ResultSet rs = dmd.getColumns("test", "public", "CUSTOMER", "%");
try {
while (rs.next()) {
System.out.println(rs.getString("COLUMN_NAME"));
}
} finally {
rs.close();
}
// print the primary key columns
rs = dmd.getIndexInfo("test", "public", "CUSTOMER", true, true);
try {
while (rs.next()) {
System.out.println(rs.getString("COLUMN_NAME"));
}
} finally {
rs.close();
}

The code prints

CUSTOMER_ID
"CUSTOMER_ID"

while it should probably have printed

CUSTOMER_ID
CUSTOMER_ID


From: Kris Jurka <books(at)ejurka(dot)com>
To: Andrei Badea <andrei(dot)badea(at)sun(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names
Date: 2007-07-23 17:32:24
Message-ID: Pine.BSO.4.64.0707231331010.27467@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Mon, 23 Jul 2007, Andrei Badea wrote:

> The following bug has been logged online:
>
> Bug reference: 3480
> Description: JDBC driver: getIndexInfo() returns quotes around quoted
> column names
> Details:
>
> The DatabaseMetaData.getIndexInfo() method returns quotes around quoted
> column names, unlike the getColumns() method. To reproduce run the following
> statement in a database named "test" and the "public" schema:
>

Fixed in CVS for 8.1, 8.2, and HEAD.

Thanks for the test case.

Kris Jurka