Bug #82206 FLOAT, DOUBLE, REAL data types are returning incompatible scale value 31
Submitted: 13 Jul 2016 1:12 Modified: 20 Jan 2022 13:50
Reporter: Lisa Cabrera Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.39 OS:Any
Assigned to: Filipe Silva CPU Architecture:Any

[13 Jul 2016 1:12] Lisa Cabrera
Description:
ResultSetMetaData.getScale(int column) returns "31" despite the fact that ResultSetMetaData.getPrecision(int column) returns incompatible values (12, 22). "31" is returned as the default scale value for FLOAT, DOUBLE, REAL data types. DBMD.getColumns()->DECIMAL_DIGITS correctly returns "null" (perhaps "0" would be better?).

How to repeat:
See Bug#82156 for details on how to reproduce this issue. Create a table with types FLOAT, DOUBLE, REAL and observe the precision/scale attributes via JDBC driver.

Suggested fix:
ResultSetMetaData.getScale(int column) should return the same value as DBMD.getColumns()->DECIMAL_DIGITS ("0" or null).
[13 Jul 2016 5:43] Chiranjeevi Battula
Hello Lisa Cabrera,

Thank you for the bug report.
Verified this behavior on MySQL Connector / J 5.1.39.

Thanks,
Chiranjeevi.
[13 Jul 2016 5:46] Chiranjeevi Battula
run:
Name=col_int
Type=4
Precision=5
Scale=0
ColumnClassName=java.lang.Integer
ColumnType=4
Name=col_float
Type=7
Precision=12
Scale=31
ColumnClassName=java.lang.Float
ColumnType=7
Name=col_dooble
Type=8
Precision=22
Scale=31
ColumnClassName=java.lang.Double
ColumnType=8
Name=col_real
Type=8
Precision=22
Scale=31
ColumnClassName=java.lang.Double
ColumnType=8
COLUMN_NAME=col_int
DATA_TYPE=4
COLUMN_SIZE=10
DECIMAL_DIGITS=0
TYPE_NAME=INT
BUILD SUCCESSFUL (total time: 1 second)
[20 Jan 2022 13:50] Alexander Soklakov
Posted by developer:
 
This bug is not reproducible with the latest Connector/J 8.0.

Connector/J 5.1 series came to EOL on Feb 9th, 2021, see https://www.mysql.com/support/eol-notice.html, so this bug will not be fixed there.