Re: DatabaseMetaData.getTablePrivileges()

From: Kris Jurka <books(at)ejurka(dot)com>
To: danap <danap(at)ttc-cmc(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: DatabaseMetaData.getTablePrivileges()
Date: 2010-10-09 06:37:38
Message-ID: alpine.BSO.2.00.1010090221170.10120@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
acldebug.patch text/plain 1.5 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message dmp 2010-10-10 20:32:20 Re: DatabaseMetaData.getTablePrivileges()
Previous Message Oliver Jowett 2010-10-08 22:27:02 Re: PostgreSQL data types mapped Java classes for JDBC