pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedDriver not returning the type for TYPEs
5+ messages / 2 participants
[nested] [flat]
* Driver not returning the type for TYPEs
@ 2010-03-07 21:45 Thomas Kellerer <spam_eater@gmx.net>
2010-03-07 22:46 ` Re: Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Kellerer @ 2010-03-07 21:45 UTC (permalink / raw)
To: pgsql-jdbc
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Driver not returning the type for TYPEs
2010-03-07 21:45 Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
@ 2010-03-07 22:46 ` Thomas Kellerer <spam_eater@gmx.net>
2010-03-21 07:27 ` Re: Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
2010-05-01 16:56 ` Re: Driver not returning the type for TYPEs Kris Jurka <books@ejurka.com>
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Kellerer @ 2010-03-07 22:46 UTC (permalink / raw)
To: pgsql-jdbc
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_' ");
}
/*
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Driver not returning the type for TYPEs
2010-03-07 21:45 Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
2010-03-07 22:46 ` Re: Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
@ 2010-03-21 07:27 ` Thomas Kellerer <spam_eater@gmx.net>
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Kellerer @ 2010-03-21 07:27 UTC (permalink / raw)
To: pgsql-jdbc
Thomas Kellerer wrote on 07.03.2010 23:46:
> 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....
Any feedback on this?
Regards
Thomas
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Driver not returning the type for TYPEs
2010-03-07 21:45 Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
2010-03-07 22:46 ` Re: Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
@ 2010-05-01 16:56 ` Kris Jurka <books@ejurka.com>
2010-05-02 09:19 ` Re: Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
1 sibling, 1 reply; 5+ messages in thread
From: Kris Jurka @ 2010-05-01 16:56 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc
On Sun, 7 Mar 2010, Thomas Kellerer wrote:
>> 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.
>>
>
> 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 ;)
>
I've applied this with additional code to separate out temporary views and
temporary sequences. A couple of notes on your patch for future
reference:
1) You have it reversed. The patch is taking out your changes rather than
adding them.
2) There are two CASE statements that convert relkind to TABLE_TYPE and
you only got one of them.
Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Driver not returning the type for TYPEs
2010-03-07 21:45 Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
2010-03-07 22:46 ` Re: Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
2010-05-01 16:56 ` Re: Driver not returning the type for TYPEs Kris Jurka <books@ejurka.com>
@ 2010-05-02 09:19 ` Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Kellerer @ 2010-05-02 09:19 UTC (permalink / raw)
To: pgsql-jdbc
Kris Jurka wrote on 01.05.2010 18:56:
> I've applied this with additional code to separate out temporary views
> and temporary sequences.
That is good news, thanks
> A couple of notes on your patch for future reference:
>
> 1) You have it reversed. The patch is taking out your changes rather
> than adding them.
It was the first time I was creating a patch. I will pay more attention in the future :)
Thanks for the feedback.
Regards
Thomas
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2010-05-02 09:19 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-03-07 21:45 Driver not returning the type for TYPEs Thomas Kellerer <spam_eater@gmx.net>
2010-03-07 22:46 ` Thomas Kellerer <spam_eater@gmx.net>
2010-03-21 07:27 ` Thomas Kellerer <spam_eater@gmx.net>
2010-05-01 16:56 ` Kris Jurka <books@ejurka.com>
2010-05-02 09:19 ` Thomas Kellerer <spam_eater@gmx.net>
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