Issue Details (XML | Word | Printable)

Key: DERBY-2260
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Saurabh Vyas
Reporter: Daniel John Debrunner
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

DatabaseMetaData.getTypeInfo() returns incorrect precision for VARCHAR FOR BIT DATA

Created: 19/Jan/07 07:39 PM   Updated: 25/Jul/08 05:35 PM
Return to search
Component/s: JDBC
Affects Version/s: 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.1.4
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

Issue Links:
Incorporates
 

Resolution Date: 07/Feb/07 03:59 AM


 Description  « Hide
PRECISION column for VARCHAR FOR BIT DATA is returned as 32762, but maximum precision is 32672 (6 & 7 swapped).

ij> create table z (a varchar(32672) for bit data);
0 rows inserted/updated/deleted
ij> create table z2(a varchar(32673) for bit data);
ERROR 42611: The length, precision, or scale attribute for column, or type mapping 'VARCHAR (32673) FOR BIT DATA' is not valid.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Saurabh Vyas added a comment - 30/Jan/07 01:51 PM
Linking this issue to Derby-2258 (https://issues.apache.org/jira/browse/DERBY-2258) as it is solved by the same patch which is available for that.

getTypeInfo() method in 'metadata.properties' returns incorrect value for the maximum precision in case of VARCHAR FOR BIT DATA.
Thus modifying the value '32672' & modifying test output also to expect the correct value.

Saurabh Vyas added a comment - 06/Feb/07 04:34 PM
This correction in the PRECISION values requires change in DatabaseMetaDataTest.java as the test now checks for correct precision.
This is also implemented in patch for Derby-2558.

NOTE : In future I 'll try and work on all issues independently & not mixing them (like what I did for Derby 2258, 2259 & 2260). My apologies if this caused inconvenience.

Saurabh Vyas added a comment - 06/Feb/07 04:44 PM
I have a question regarding assertFalse(rs.wasNull()) in testGetTypeInfo() method in DatabaseMetaDataTest.java. After one 'assertEquals' for precision, there is an 'assertFalse'. Why this assert is required? This assert was failing for me (after I had added case for XML data type for precision).
Did I missed any thing in the test ?

Daniel John Debrunner added a comment - 06/Feb/07 05:15 PM
It was just a safety check to ensure that a NULL value was not being returned for precision. Probably not required (before the XML changes) since a precision of zero was never returned. We can assume that a NULL will be returned as zero.

Now with the addition of an XML type you need to test that a NULL value is being returned, checking for a precision of 0 is not enough. So for the XML case you need ensure that rs.wasNull() returns true.

Saurabh Vyas added a comment - 06/Feb/07 05:42 PM
Thanks again. Added the check for XML data type that it can have NULL value for precision, for other precision cannot be NULL.
New patch for DERBY-2258 (Derby-2258_v4) addressed this change.