Re: DatabaseMetaData.getTablePrivileges() - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: DatabaseMetaData.getTablePrivileges()
Date
Msg-id alpine.BSO.2.00.1010090221170.10120@leary.csoft.net
Whole thread Raw
In response to DatabaseMetaData.getTablePrivileges()  (danap <danap@ttc-cmc.net>)
Responses Re: DatabaseMetaData.getTablePrivileges()  (dmp <danap@ttc-cmc.net>)
List pgsql-jdbc

On Thu, 7 Oct 2010, danap wrote:

> Today I update the one of the development systems for the MyJSQLView
> project to test the PostgreSQL 9.0 database. Once the database was
> installed and also the latest JDBC 9.0-801 I tested the program. The
> application crashed and after some testing I attributed the exception to
> the empty string "" parameter for the schemaPattern argument in
> DatabaseMetaData.getTablePrivileges() for the JDBC.
>
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>       at java.lang.String.substring(Unknown Source)
>       at
> org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.addACLPrivileges(AbstractJdbc2DatabaseMetaData.java:2799)
>       at
> org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.parseACL(AbstractJdbc2DatabaseMetaData.java:2878)
>       at
> org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getTablePrivileges(AbstractJdbc2DatabaseMetaData.java:2700)
>       at

This error has nothing to do with using "" as a schema pattern.  The
problem is that the server is supplying an ACL that the JDBC driver is
failing to parse correctly.  So if these are the same databases, something
has changed in the 9.0 representation of privileges.  I'm not sure what
that change might be.  I've built a driver with the attached patch to show
the failing ACL.  If you can provide the output on the failure, we can
likely fix it with little trouble.

http://ejurka.com/pgsql/jars/acl/

Kris Jurka

Attachment

pgsql-jdbc by date:

Previous
From: danap@itstriangle.com
Date:
Subject: DatabaseMetaData.getTablePrivileges()
Next
From: dmp
Date:
Subject: Re: DatabaseMetaData.getTablePrivileges()