summaryrefslogtreecommitdiff
path: root/mysql-test/t/insert.test
diff options
context:
space:
mode:
authorunknown <kaa@polly.(none)>2007-10-15 10:34:34 +0400
committerunknown <kaa@polly.(none)>2007-10-15 10:34:34 +0400
commit4eec3b087de468382f6c4e9eb2397cacfc18821f (patch)
tree5d67a26046a389ccea7dc8033cc84ade4151240b /mysql-test/t/insert.test
parent06e9aae7071359d06c641325ef1723cd1c44d563 (diff)
downloadmariadb-git-4eec3b087de468382f6c4e9eb2397cacfc18821f.tar.gz
Fix for bug #30453: String not cast to int correctly.
Problem: my_strntoull10rnd_8bit() handled incorrectly cases when the input string contains a decimal point and is long enough to overrun the 'unsigned long long' type. The position of the decimal point was not taken into account which resulted in miscalculated numbers and truncation to appropriate SQL data type limits. Solution: Fix my_strntoull10rnd_8bit() to take the position of a decimal point into account in such cases. mysql-test/r/insert.result: Added a test case for bug #30453. mysql-test/t/insert.test: Added a test case for bug #30453. strings/ctype-simple.c: In cases when the 'unsigned long long' type is overrun by the input string and a decimal point has occurred, adjust the 'shift' according to the position of the decimal point and skip all subsequent digits.
Diffstat (limited to 'mysql-test/t/insert.test')
-rw-r--r--mysql-test/t/insert.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 76177403bd0..c36408a52fe 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -353,5 +353,20 @@ SELECT * FROM t2;
DROP TABLE t1, t2;
+#
+# Bug #30453: String not cast to int correctly
+#
+
+CREATE TABLE t1 (c1 INT NOT NULL);
+INSERT INTO t1 VALUES(4188.32999999999992724042385816574096679687500),
+('4188.32999999999992724042385816574096679687500'), (4188);
+SELECT * FROM t1;
+
+CREATE TABLE t2 (c1 BIGINT);
+INSERT INTO t2 VALUES('15449237462.0000000000');
+SELECT * FROM t2;
+
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests.