Hi to all.
I've recently got a bug that's somewhat weird for me. Let's consider that we have a table with a column of FLOAT(8, 3). Let's also consider we have a validated table editor accessible via web browser. The table editor supports the client-side validation for every column, and does not allow to put floats that are not in the range specified by the column type using a simple JavaScript regular expression, e.g.:
var rx = new RegExp("^\\d{1," + (total - precision) + "}(\\.\\d{1," + precision + "})?$");
representing simply:
^\d{1,5}(\.\d{1,3})?$
for FLOAT(8, 3). A user can easily input 99999.999 into that cell, and when he saves the changes, he gets 100000 in the cell - a precision-lost value that's invalid for the table column constraint. I tried to extend the validator regular expression to pass 100000, but this value cannot be saved into the DB. Wow... It was expected because of "Out of range value for column 'COLUMN' at row N", but I did not expect that the MySQL console (does not show a warning) and SQLyog (shows a warning) will allow the following UPDATE
query:
UPDATE TABLE SET COLUMN = 100000; /* No matter it's out of range for FLOAT(8, 3), it's trimmed but not via JDBC MySQL driver*/
Obviously it's the MySQL connector specific issue. Is it a bug of the MySQL connector (currently I use mysql-connector-java-5.1.12-bin.jar
)? Or are there any quick workarounds allowing to put 100000 (ideally a maximum value) trimmed or adjusted by the JDBC driver?
Thanks in advance.