pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmp <danap@ttc-cmc.net>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: DatabaseMetaData.getTablePrivileges()
Date: Sun, 10 Oct 2010 14:32:20 -0600
Message-ID: <4CB222D4.4090401@ttc-cmc.net> (raw)
In-Reply-To: <alpine.BSO.2.00.1010090221170.10120@leary.csoft.net>
References: <4CAE7105.1080805@ttc-cmc.net>
	<alpine.BSO.2.00.1010090221170.10120@leary.csoft.net>

> 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)
>> org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.addACLPrivileges(AbstractJdbc2DatabaseMetaData.java:2799)
>> org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.parseACL(AbstractJdbc2DatabaseMetaData.java:2878)
>> org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getTablePrivileges(AbstractJdbc2DatabaseMetaData.java:2700)

> Kris Jurka wrote:

> 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

I guess some additional information should have been provided
with the initial posting. The newly installed 9.0.1 database was
done anew. The database was dumped from 8.4.4 then imported into
the new 9.0.1 configuration. So the databases were the same. Second
I had already gotten the application up and running before posting
here by providing the space character for the schemaPattern parameter in 
the getTablePrivileges() method.

Now it looks like you said Kris the exception has nothing to do with
the empty space, "", parameter for the schemaPattern except either
that documented valid input or NULL will bring out the exception. The
exception as your patch looks for has to do with parsing the reacl
entry. That entry is for the pg_largeobject and is {}.

The SQL query to bring up the needed data to see this is:

SELECT n.nspname,c.relname,u.usename,c.relacl  FROM 
pg_catalog.pg_namespace n, pg_catalog.pg_class c, pg_catalog.pg_user u 
WHERE c.relnamespace = n.oid  AND u.usesysid = c.relowner  AND c.relkind 
= 'r'  AND c.relname LIKE '%'  ORDER BY nspname, relname

I'm not sure if the mail list will except it, but attached is the
pdf output for that query for both the 8.4.4 and 9.0.1 databases.

Links here:
http://dandymadeproductions.com/temp/sql_empty_schemaPattern_8.4.4.pdf
http://dandymadeproductions.com/temp/sql_empty_schemaPattern_9.0.1.pdf

danap.

Attachments:

  sql_empty_schemaPattern_8.4.4.pdf (application/pdf, 5.5K) download

  sql_empty_schemaPattern_9.0.1.pdf (application/pdf, 5.7K) download

view thread (8+ messages)  latest in thread

Message-ID: <4CB222D4.4090401@ttc-cmc.net>
Permalink:  ../4CB222D4.4090401@ttc-cmc.net/
Also on:    postgresql.org/message-id/4CB222D4.4090401@ttc-cmc.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: danap@ttc-cmc.net, books@ejurka.com
  Subject: Re: DatabaseMetaData.getTablePrivileges()
  In-Reply-To: <4CB222D4.4090401@ttc-cmc.net>
  References: <4CAE7105.1080805@ttc-cmc.net> <alpine.BSO.2.00.1010090221170.10120@leary.csoft.net> <4CB222D4.4090401@ttc-cmc.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox