| Bug #27916 | DatabaseMetaData.getTypeInfo() does not return all the available data types | ||
|---|---|---|---|
| Submitted: | 18 Apr 2007 9:05 | Modified: | 8 Oct 2007 17:40 |
| Reporter: | Alexander Hristov (Candidate Quality Contributor) | ||
| Status: | Closed | ||
| Category: | Connector/J | Severity: | S3 (Non-critical) |
| Version: | 5.0.5 | OS: | Any |
| Assigned to: | Target Version: | ||
| Tags: | getTypeInfo, metadata, getColumns | ||
[2 May 2007 10:31]
Tonci Grgin
Hi Alexander and thanks for your report. Verified as described with MySQL server 5.0.38BK on WinXP Pro SP2. Details inside attached test case. There was 1 failure: 1) testBug27916(testsuite.simple.TestBug27916)junit.framework.AssertionFailedError: int unsigned
[2 May 2007 10:32]
Tonci Grgin
Test case
Attachment: TestBug27916.java (text/x-java), 2.78 KiB.
[3 Oct 2007 16:24]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34828
[3 Oct 2007 16:53]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34829
[3 Oct 2007 16:59]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34830
[3 Oct 2007 18:42]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34839
[3 Oct 2007 18:46]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34840
[3 Oct 2007 20:59]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34855
[4 Oct 2007 22:42]
Mark Matthews
Fixed for 5.0.8.
[5 Oct 2007 20:53]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35011
[8 Oct 2007 17:40]
MC Brown
A note has been added to the 5.0.8 changelog: UNSIGNED types not reported via DBMD.getTypeInfo(), and capitalization of type names is not consistent between DBMD.getColumns(), RSMD.getColumnTypeName() and DBMD.getTypeInfo(). This fix also ensures that the precision of UNSIGNED MEDIUMINT and UNSIGNED BIGINT is reported correctly via DBMD.getColumns().
[11 Oct 2007 22:11]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35407
[11 Oct 2007 22:24]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35410
[11 Oct 2007 22:52]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35414
[19 Nov 2007 1:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/38019
[19 Nov 2007 3:52]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/38024

Description: getTypeInfo() should return (as per the JDBC spec) all the data types supported by the database. Yet for many tables reading the type information of a column using the getColumns() method from DatabaseMetaData provides a TYPE_NAME that wasn't previously reported by getTypeInfo(). An Example of TYPE_NAMEs reported by getColumns() but not present in getTypeInfo() is "int unsigned". Also, capitalization of the type name in getTypeInfo() and getColumns() is inconsistent : in the first one types are reported uppercased, in the second - lowercased How to repeat: import java.sql.*; import java.util.*; public class Bug { public static void main(String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver"); Properties properties = new Properties(); properties.setProperty("user","..."); properties.setProperty("password","..."); properties.setProperty("useInformationSchema","true"); properties.setProperty("nullCatalogMeansCurrent","false"); Connection con =DriverManager.getConnection("jdbc:mysql://localhost/test",properties); DatabaseMetaData dbmt = con.getMetaData(); ResultSet rs = dbmt.getTypeInfo(); ArrayList types = new ArrayList(); System.out.println("Available data types"); while (rs.next()) { System.out.println(rs.getString("TYPE_NAME")); types.add(rs.getString("TYPE_NAME").toLowerCase()); } System.out.println(); System.out.println(); rs = dbmt.getColumns("mysql",null,"time_zone_transition","%"); while (rs.next()) { String typeName = rs.getString("TYPE_NAME").toLowerCase(); System.out.println(typeName+ " "+(types.contains(typeName)?"found":"not found")); } } }