JDBC javadoc is vague (just says "precision"). Since it also

returns radix information for a column, it woudl seem reasonable

to interpret precision in terms of that.

I checked the SQL standard's precision concept:

ISO-IEC 9075-2-2003, Section 4.4.1 states that a numeric type

is decribed by, among other properties, a precision which can be either binary or decimal.

Section 6.1 for <exact numeric type> allows an implementation to

define radix for precision for INT, SMALLINT and BIGINT as either

binary or decimal. I assume for Derby this is binary.

NUMERIC and DECIMAL have decimal precision.

Section 4.4.2 says about approximate numeric values (REAL, FLOAT and DOUBLE values

are such, see 6.1): "An approximate numeric value has a precision.

The precision is a positive integer that specifies the number of significant

binary digits in the mantissa."

This makes me believe the correct precision for REAL, FLOAT and DOUBLE

should be in terms of binary digits. We could ping Lance...

After some investigation I found that getDigitPrecision() method in DataTypeUtilities.java returns precision values which is inconsistent with that returned from metadata.properties. I tried following modification :

public static int getDigitPrecision(DataTypeDescriptor dtd) {

{ case Types.FLOAT: case Types.DOUBLE: //return TypeId.DOUBLE_PRECISION_IN_DIGITS; return TypeId.DOUBLE_PRECISION; case Types.REAL: //return TypeId.REAL_PRECISION_IN_DIGITS; return TypeId.REAL_PRECISION; //Added case for Date & time data type case Types.DATE: case Types.TIME: case Types.TIMESTAMP: return dtd.getMaximumWidth(); default: return getPrecision(dtd); }int typeId = dtd.getTypeId().getJDBCTypeId();

switch ( typeId )

Then I tried the assert in crossCheckGetColumnRowAndResultSetMetaData() method of DatabaseMetaDataTest.java which was failing for DATE , REAL and other data types :

assertEquals("COLUMN_SIZE", rsmdt.getPrecision(col), rs.getInt("COLUMN_SIZE"));

After above change, DATE & REAL data type are consistent in precision values and assert but I got assert for JAVACLASSNAME type. This I was not able to root cause.

Now I have two questions :