pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Driver does not report all catalogs
5+ messages / 2 participants
[nested] [flat]

* Driver does not report all catalogs
@ 2005-11-29 09:48  Martin Keller <martin.keller@unitedplanet.de>
  0 siblings, 1 reply; 5+ messages in thread

From: Martin Keller @ 2005-11-29 09:48 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

newer versions of the PostgreSQL JDBC driver don't return all databases 
of the server when calling DatabaseMetaData.getCatalogs(...).
Can anyone tell me, why this change was neccessary? It's incompatible to 
JDBC spec and brakes existing code.

Regards,
Martin




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Driver does not report all catalogs
@ 2005-11-29 20:12  Kris Jurka <books@ejurka.com>
  parent: Martin Keller <martin.keller@unitedplanet.de>
  0 siblings, 1 reply; 5+ messages in thread

From: Kris Jurka @ 2005-11-29 20:12 UTC (permalink / raw)
  To: Martin Keller <martin.keller@unitedplanet.de>; +Cc: pgsql-jdbc



On Tue, 29 Nov 2005, Martin Keller wrote:

> newer versions of the PostgreSQL JDBC driver don't return all databases of 
> the server when calling DatabaseMetaData.getCatalogs(...).
> Can anyone tell me, why this change was neccessary? It's incompatible to JDBC 
> spec and brakes existing code.
>

This was discussed quite some time ago, starting here:

http://archives.postgresql.org/pgsql-jdbc/2004-01/msg00154.php

The core issue is that while we can return a list of catalogs, you can't 
do anything with them.  Connection.setCatalog does nothing.  Other 
metadata methods ignore the catalog filter as well.  Pretending the other 
catalogs don't exist makes certain applications work better, DBVisualizer 
for example.  What are you using it for?

Kris Jurka



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Driver does not report all catalogs
@ 2005-11-30 07:39  Martin Keller <martin.keller@unitedplanet.de>
  parent: Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Martin Keller @ 2005-11-30 07:39 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc

We use this to show the list of available databases to the users. I 
know, that this list can be retrieved with a select on pg_database, but 
our application runs with various database systems and we try to avoid 
database specific code. The issues with some of the metadata methods and 
Connection.setCatalog don't affect the rest of our code, because the 
connections are dedicated to each used database.

Martin Keller

Kris Jurka wrote:

>
>
> On Tue, 29 Nov 2005, Martin Keller wrote:
>
>> newer versions of the PostgreSQL JDBC driver don't return all 
>> databases of the server when calling DatabaseMetaData.getCatalogs(...).
>> Can anyone tell me, why this change was neccessary? It's incompatible 
>> to JDBC spec and brakes existing code.
>>
>
> This was discussed quite some time ago, starting here:
>
> http://archives.postgresql.org/pgsql-jdbc/2004-01/msg00154.php
>
> The core issue is that while we can return a list of catalogs, you 
> can't do anything with them.  Connection.setCatalog does nothing.  
> Other metadata methods ignore the catalog filter as well.  Pretending 
> the other catalogs don't exist makes certain applications work better, 
> DBVisualizer for example.  What are you using it for?
>
> Kris Jurka





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Driver does not report all catalogs
@ 2005-11-30 08:45  Kris Jurka <books@ejurka.com>
  parent: Martin Keller <martin.keller@unitedplanet.de>
  0 siblings, 1 reply; 5+ messages in thread

From: Kris Jurka @ 2005-11-30 08:45 UTC (permalink / raw)
  To: Martin Keller <martin.keller@unitedplanet.de>; +Cc: pgsql-jdbc



On Wed, 30 Nov 2005, Martin Keller wrote:

> We use this to show the list of available databases to the users. I know, 
> that this list can be retrieved with a select on pg_database, but our 
> application runs with various database systems and we try to avoid database 
> specific code. The issues with some of the metadata methods and 
> Connection.setCatalog don't affect the rest of our code, because the 
> connections are dedicated to each used database.
>

If you don't setCatalog or use metadata, what do you do with the 
database names once you've got them?  Put it in a connection url? 
Clearly this is a database dependent task.  How do you do a login before 
getting the list of databases?  How do you know the given user can connect 
to the given database?

This list of problems shows why I don't think it's a real good idea to 
advertise the list of databases.  Now I did make this change relatively 
recently on a nearly two year old discussion, so I'm certainly willing to 
reopen it, but you can see which side I'm leaning towards.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Driver does not report all catalogs
@ 2005-11-30 10:03  Kris Jurka <books@ejurka.com>
  parent: Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Kris Jurka @ 2005-11-30 10:03 UTC (permalink / raw)
  To: Martin Keller <martin.keller@unitedplanet.de>; +Cc: pgsql-jdbc



On Wed, 30 Nov 2005, Martin Keller wrote:

> Yes, we are using the names for building connection urls and so far you are 
> right, that this is a database dependent task. There is some user interaction 
> neccessary, if user credentials differ. Our code related to this works for 
> years now and most parts of it are portable, some are not.
> I understand and respect your opinion but you should consider, that changing 
> driver behaviour this way is a dangerous thing. It does not meet the spec 
> (the spec only says, what DatabaseMetaData.getCatalogs() has to do, but not, 
> that this is dependent on the behavior of any other method) and breaks 
> existing code.
>

Keeping this on list is where you are likely to find friends in this 
discussion.  I'd certainly like to hear from any other dissenting or 
concurring opinions.  Perhaps citing the list of other databases that 
implement getCatalogs as you'd like would be useful.  Also noting their 
stance on setCatalog and metadata would help.

Naturally the Javadoc you refer to is vague, it states, "Retrieves 
the catalog names available in this database."  Now clearly my question is 
available to what?  My answer is to call setCatalog or query metadata.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2005-11-30 10:03 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-11-29 09:48 Driver does not report all catalogs Martin Keller <martin.keller@unitedplanet.de>
2005-11-29 20:12 ` Kris Jurka <books@ejurka.com>
2005-11-30 07:39   ` Martin Keller <martin.keller@unitedplanet.de>
2005-11-30 08:45     ` Kris Jurka <books@ejurka.com>
2005-11-30 10:03       ` Kris Jurka <books@ejurka.com>

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