DatabaseMetaData.getIndexInfo() added

From: William Webber <william(at)ferengi(dot)live(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: DatabaseMetaData.getIndexInfo() added
Date: 2001-02-01 03:56:31
Message-ID: 20010201145631.A15468@ferengi.live.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

Hi all!

Attached is a patch that implements DatabaseMetaData.getIndexInfo()
for the JDBC2 driver. It also fixes a compile error under jikes by
casting characters in case statements of a byte-compared switch to
bytes.

A few notes on getIndexInfo():

1.) getArray() is not implemented for the postgresql JDBC driver yet,
so getIndexInfo() parses the pg_index.indkey field into separate
integers by hand.

2.) I have guessed that if pg_index.indisclustered is "false", then
the index is "hashed"; if not, line 2561 of the resultant class
should have "tableIndexOther" rather than "tableIndexHashed".

3.) I didn't know what sort sequence (if any) was used in indexes, so
I have set it to "null" (unknown) on line 2566.

4.) For "CARDINALITY" (number of unique index items, the 11th field of
the ResultSet returned by getIndexInfo()) I have used
pg_classes.reltuples.

I have tested this method, but hardly extensively. Is there a proper
regression test suite for the JDBC driver that tests can be added to?

William
--
William Webber william(at)peopleweb(dot)net(dot)au
Senior Programmer
PeopleWeb Australia http://www.peopleweb.com

Attachment Content-Type Size
DatabaseMetaData.java.patch text/plain 3.5 KB

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter T Mount 2001-02-01 09:13:27 Re: PreparedStatement suggestion
Previous Message Philip Crotwell 2001-01-31 16:35:58 PreparedStatement suggestion

Browse pgsql-patches by date

  From Date Subject
Next Message Robert B. Easter 2001-02-01 04:45:36 queries.sgml.patch
Previous Message Ryan Kirkpatrick 2001-01-31 03:01:02 Re: A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....