summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2012-01-25 16:11:03 +0100
committerTor Didriksen <tor.didriksen@oracle.com>2012-01-25 16:11:03 +0100
commit4172d5e9a9f1c637914fa99640a30a75b6d517d3 (patch)
tree92e6aaf409caabd2e8f942537cef889e9e0f19cc /mysql-test
parentc79641594348cb855d3b682c122e681499ae3aed (diff)
downloadmariadb-git-4172d5e9a9f1c637914fa99640a30a75b6d517d3.tar.gz
Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662
Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN When parsing the fractional part of a string which is to be converted to double, we can stop after a few digits: the extra digits will not contribute to the actual result anyways. mysql-test/r/func_str.result: New tests. mysql-test/t/func_str.test: New tests. strings/dtoa.c: The problem was s2b() multiplying and adding hundreds-of-thousands of ever smaller fractions.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_str.result36
-rw-r--r--mysql-test/t/func_str.test39
2 files changed, 75 insertions, 0 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index abf76a533b3..adaa2df3a61 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2826,5 +2826,41 @@ SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
((0xf3) * (rpad(1.0,2048,1)) << (0xcc))
0
#
+# Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662:
+# BALLOC: ASSERTION `K <= 15' FAILED.
+# Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN
+# EXTRAORDINARY LONG TIME TO EXECUTE
+SELECT @tmp_max:= @@global.max_allowed_packet;
+@tmp_max:= @@global.max_allowed_packet
+1048576
+SET @@global.max_allowed_packet=1024*1024*1024;
+SELECT @@global.max_allowed_packet;
+@@global.max_allowed_packet
+1073741824
+do
+format(rpad('111111111.1',
+1111111,
+'999999999999999999999999999999999999999999'),0,'be_BY')
+;
+DO
+round(
+concat( (
+coalesce( (
+linefromwkb('2147483648',
+-b'1111111111111111111111111111111111111111111')),
+( convert('[.DC2.]',decimal(30,30)) ),
+bit_count('')
+) ),
+( lpad( ( elt('01','}:K5')),
+sha1('P'),
+( ( select '-9223372036854775808.1' > all (select '')))
+)
+)
+)
+);
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
+SET @@global.max_allowed_packet:= @tmp_max;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 083ed396527..27e196e5b0c 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1459,6 +1459,45 @@ SELECT stddev_samp(rpad(1.0,2048,1));
SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
+--echo #
+--echo # Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662:
+--echo # BALLOC: ASSERTION `K <= 15' FAILED.
+--echo # Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN
+--echo # EXTRAORDINARY LONG TIME TO EXECUTE
+
+SELECT @tmp_max:= @@global.max_allowed_packet;
+SET @@global.max_allowed_packet=1024*1024*1024;
+# switching connection to allow the new max_allowed_packet take effect
+--connect (newconn, localhost, root,,)
+
+SELECT @@global.max_allowed_packet;
+
+do
+format(rpad('111111111.1',
+ 1111111,
+ '999999999999999999999999999999999999999999'),0,'be_BY')
+;
+
+DO
+round(
+ concat( (
+ coalesce( (
+ linefromwkb('2147483648',
+ -b'1111111111111111111111111111111111111111111')),
+ ( convert('[.DC2.]',decimal(30,30)) ),
+ bit_count('')
+ ) ),
+ ( lpad( ( elt('01','}:K5')),
+ sha1('P'),
+ ( ( select '-9223372036854775808.1' > all (select '')))
+ )
+ )
+ )
+);
+
+--connection default
+SET @@global.max_allowed_packet:= @tmp_max;
+--disconnect newconn
--echo #
--echo # End of 5.5 tests