pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: Driver not returning the type for TYPEs
Date: Sun, 07 Mar 2010 23:46:55 +0100
Message-ID: <hn1acl$95j$1@dough.gmane.org> (raw)
In-Reply-To: <hn16q4$upd$1@dough.gmane.org>
References: <hn16q4$upd$1@dough.gmane.org>

Thomas Kellerer wrote on 07.03.2010 22:45:
> Hi,
>
> I just noticed a minor glitchin the driver (8.4)
>
> When creating types using e.g.:
>
> CREATE TYPE my_tabpe AS (some_data varchar(100));
>
> DatabaseMetaData.getTables() will return that type, but the value for
> the column TABLE_TYPE is null.
>
> I think if the driver returns non-table objects (which is fine, a lot of
> drivers are doing that), the TABLE_TYPE column of the result set should
> contain a proper value.
>
> Regards
> Thomas

I had a quick look at the source code, and it seems quite simple to fix.

I have attached a patch agains CVS head which (as far as I can tell) fixes this.
It also supports getTables() passing "TYPE" in the String array to select which types to show.

I hope the patch is OK, I have not used the diff tool before ;)

But the changes are really very minimal, I hope I found all places....

Regards
Thomas

Attachments:

AbstractJdbc2DatabaseMetaData.diff (text/plain, 1.2K) download # This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. --- C:\Projects\pgjdbc\pgjdbc\org\postgresql\jdbc2\AbstractJdbc2DatabaseMetaData.java +++ C:\Projects\pgjdbc\head\pgjdbc\org\postgresql\jdbc2\AbstractJdbc2DatabaseMetaData.java @@ -1964,7 +1964,6 @@ " WHEN 'i' THEN 'INDEX' " + " WHEN 'S' THEN 'SEQUENCE' " + " WHEN 'v' THEN 'VIEW' " + - " WHEN 'c' THEN 'TYPE' " + " ELSE NULL " + " END " + " ELSE NULL " + @@ -2110,10 +2109,6 @@ tableTypeClauses.put("TEMPORARY INDEX", ht); ht.put("SCHEMAS", "c.relkind = 'i' AND n.nspname ~ '^pg_temp_' "); ht.put("NOSCHEMAS", "c.relkind = 'i' AND c.relname ~ '^pg_temp_' "); - ht = new Hashtable(); - tableTypeClauses.put("TYPE", ht); - ht.put("SCHEMAS", "c.relkind = 'c' AND n.nspname ~ '^pg_temp_' "); - ht.put("NOSCHEMAS", "c.relkind = 'c' AND c.relname ~ '^pg_temp_' "); } /*

view thread (5+ messages)  latest in thread

Message-ID: <hn1acl$95j$1@dough.gmane.org>
Permalink:  ../hn1acl$95j$1@dough.gmane.org/
Also on:    postgresql.org/message-id/hn1acl$95j$1@dough.gmane.org

 ·  · 

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: spam_eater@gmx.net
  Subject: Re: Driver not returning the type for TYPEs
  In-Reply-To: <hn1acl$95j$1@dough.gmane.org>
  References: <hn16q4$upd$1@dough.gmane.org> <hn1acl$95j$1@dough.gmane.org>

* 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