Re: Auto-increment serial (Postgresql JDBC driver w/ - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Auto-increment serial (Postgresql JDBC driver w/
Date
Msg-id Pine.BSO.4.56.0409221454160.32134@leary.csoft.net
Whole thread Raw
In response to Re: Auto-increment serial (Postgresql JDBC driver w/  ("Jaroslaw J. Pyszny" <arghil@poczta.onet.pl>)
Responses Re: Auto-increment serial (Postgresql JDBC driver w/  ("Jaroslaw J. Pyszny" <arghil@poczta.onet.pl>)
List pgsql-jdbc

On Wed, 22 Sep 2004, Jaroslaw J. Pyszny wrote:

> W liście z sro, 22-09-2004, godz. 00:50, Dave Cramer pisze:
> > Sorry, missed one more where clause.
> >
> > select column_default from information_schema.columns where table_name =
> > 'xyz' and column_name = 'id';
> >
> > This assumes a table defined like create table xyz (id serial);
> It's works but only for the owner of the table
> or I do something wrong ;)
>

The information_schema takes into account permissions on objects and
doesn't show things you can't access.  So in this case a GRANT SELECT ON
<table> TO <user> would make it show up.  This seems OK because to get a
ResultSet you clearly have to be able to query the table.

The problem I came across was that if you only grant access to the table
it doesn't propagate to the underlying sequence.  So if a user doesn't
have permissions to use the sequence it doesn't show up as the default in
the information_schema view.  I'm leaning towards believing this is a bug
in the information_schema, but it just seems safer to use the direct
catalog access method you wrote.

Kris Jurka


pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Problem linking Postgresql JDBC driverb and Matlab (Linux)
Next
From: Oliver Jowett
Date:
Subject: Re: raising the default prepareTheshold