Bug #50968 | Insertion id is Long instead of BigInteger for BIGINT unsigned ID column | ||
---|---|---|---|
Submitted: | 6 Feb 2010 23:09 | Modified: | 9 Feb 2010 9:50 |
Reporter: | shaoxian yang | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | Connector / J | Severity: | S1 (Critical) |
Version: | 5.1.10 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | mysql jdbc BIGINT problem |
[6 Feb 2010 23:09]
shaoxian yang
[6 Feb 2010 23:35]
shaoxian yang
Test files to verify the bug reporting
Attachment: bigint_bug_test.rar (application/octet-stream, text), 2.11 KiB.
[8 Feb 2010 14:34]
Mark Matthews
This is a server/protocol bug. MySQL doesn't return any sign information as part of the return value for an INSERT containing an auto increment column, therefore the driver can't imply the type ahead of time. If, however, the server does return an unsigned long value that is larger than Long.MAX_VALUE (and thus the sign goes negative), the driver detects this condition and returns BigInteger as the type with the correct unsigned value.
[8 Feb 2010 19:27]
shaoxian yang
Mark, Thanks for the reply. That makes sense, as long as it will return biginteger when value exceed the long limit. I will modify my application logic since my entity objecty field type if BigInteger: explicitly check the returned type from result. If it is long, convert to BigInteger. If it is BigInteger, return as it is. May I check if this still remain a bug but belonging to Server bug, or there is nothing to be fixed even at MYSQL server side? Thanks. If it is not bug, please close it, or instruct me to do so. Shaoxian Yang
[9 Feb 2010 9:50]
Tonci Grgin
Shaoxian, there is already a bug report for your problem; Bug#20964.