BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names - Mailing list pgsql-bugs

From Andrei Badea
Subject BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names
Date
Msg-id 200707231358.l6NDwlWh026230@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #3480: JDBC driver: getIndexInfo() returns quotes around quoted column names
List pgsql-bugs
The following bug has been logged online:

Bug reference:      3480
Logged by:          Andrei Badea
Email address:      andrei.badea@sun.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

pgsql-bugs by date:

Previous
From: "Tiago Jacobs"
Date:
Subject: BUG #3479: contraint exclusion and locks
Next
From: Gregory Stark
Date:
Subject: Re: BUG #3479: contraint exclusion and locks