Lists: | pgsql-jdbc |
---|
From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | getTypeInfo() bug |
Date: | 2004-01-07 22:36:24 |
Message-ID: | bti1la$dei$1@sea.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Hello,
I think there is a bug in the DatabaseMetaData.getTypeInfo() implementation
(or at least in pg73jdbc3.jar)
From the documentation of that method:
Retrieves a description of all the standard SQL types supported by this
database. They are ordered by DATA_TYPE and then by how closely the data
type maps to the corresponding JDBC SQL type.
My understanding of this is, that the first TYPE_NAME (column 1 from the
ResultSet) will match the DATA_TYPE best, the next one will second best etc.
Now for java.sql.Types.VARCHAR the first TYPE_NAME returned is 'name', the
next one is 'text'. The third match returned is 'varchar'.
I would expect the first match to be varchar and then text and name, as
varchar will match java.sql.Types.VARCHAR better then text or name.
Did I misunderstand the description of this method, or is this really a bug
in the JDBC driver?
Additionally, I also don't understand why table and view names are mapped
to java.sql.Types.OTHER?
Kind regards
Thomas
From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: getTypeInfo() bug |
Date: | 2004-01-08 00:02:32 |
Message-ID: | 3FFC9E18.8080909@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Thomas Kellerer wrote:
> Hello,
>
> I think there is a bug in the DatabaseMetaData.getTypeInfo()
> implementation (or at least in pg73jdbc3.jar)
>
> From the documentation of that method:
>
> Retrieves a description of all the standard SQL types supported by this
> database. They are ordered by DATA_TYPE and then by how closely the data
> type maps to the corresponding JDBC SQL type.
>
> My understanding of this is, that the first TYPE_NAME (column 1 from the
> ResultSet) will match the DATA_TYPE best, the next one will second best
> etc.
Yes, as currently implemented getTypeInfo() isn't very useful for
selecting a DB type to use for a given JDBC type.
I submitted a patch to improve it a long time ago, but it wasn't applied
as it didn't build on 1.1 JVMs -- and I haven't have the time or need to
fix it up. It should be in the list archives somewhere if you're interested.
-O