Bug #44451 getTables does not return resultset with expected columns
Submitted: 24 Apr 2009 6:34 Modified: 22 Jul 2013 14:32
Reporter: Vivekanand Bachche Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.7 OS:Windows
Assigned to: Filipe Silva CPU Architecture:Any

[24 Apr 2009 6:34] Vivekanand Bachche
Description:
As per the documentation for getTables (http://java.sun.com/j2se/1.4.2/docs/api/)

result set returned should contain at least 10 columns-
TABLE_CAT
TABLE_SCHEM
TABLE_NAME
TABLE_TYPE
REMARKS
TYPE_CAT
TYPE_SCHEM
TYPE_NAME
SELF_REFERENCING_COL_NAME
REF_GENERATION

5 missing columns are-
TYPE_CAT
TYPE_SCHEM
TYPE_NAME
SELF_REFERENCING_COL_NAME
REF_GENERATION

How to repeat:
Call getTables and describe the resultset returned.
[24 Apr 2009 14:43] Tonci Grgin
Hi Vivekanand and thanks for your report.

You are right but columns you describe but they just do not exist in MySQL dialect so providing them would be of no use (NULL all the time).

However, there is a discrepancy between our result and java specs so verified as described...
[17 Aug 2012 21:45] Raffaele Liverani
colum 'REMARKS' is always empty, even though the table has a comment
[14 Dec 2012 22:08] Sveta Smirnova
Bug #66911 was marked as duplicate of this one.

Bug #66911 also complains about getUDTs
[22 Jul 2013 14:32] Daniel So
Added an entry to the Connector/J 5.1.25 changelog:

The result set returned by getTables did not contain all the columns as
specified in the JDBC specification. Even though the missing columns are not
meaningful to MySQL, the getTables method is modified to add null fields to
the result set in order to make it compliant with the JDBC specification.
Other methods including getColumns, getFunctionColumns, getFunctions,
getProcedureColumns, and getUDTs are also modified to address the same issue
pertaining to them.