Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E8F856327ED for ; Sun, 7 Mar 2010 18:47:09 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 82565-07 for ; Sun, 7 Mar 2010 22:46:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 2114E632322 for ; Sun, 7 Mar 2010 18:46:58 -0400 (AST) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1NoPFP-0000xQ-MU for pgsql-jdbc@postgresql.org; Sun, 07 Mar 2010 23:46:55 +0100 Received: from ppp-93-104-164-129.dynamic.mnet-online.de ([93.104.164.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 07 Mar 2010 23:46:55 +0100 Received: from spam_eater by ppp-93-104-164-129.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 07 Mar 2010 23:46:55 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: Driver not returning the type for TYPEs Date: Sun, 07 Mar 2010 23:46:55 +0100 Lines: 71 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080904070304080201000208" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ppp-93-104-164-129.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/21 X-Sequence-Number: 20361 This is a multi-part message in MIME format. --------------080904070304080201000208 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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 --------------080904070304080201000208 Content-Type: text/plain; name="AbstractJdbc2DatabaseMetaData.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="AbstractJdbc2DatabaseMetaData.diff" # 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_' "); } /* --------------080904070304080201000208--