summaryrefslogtreecommitdiff
path: root/mysql-test/main/func_math.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/func_math.test')
-rw-r--r--mysql-test/main/func_math.test38
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test
index 6d28d99006a..4d65f5e00b0 100644
--- a/mysql-test/main/func_math.test
+++ b/mysql-test/main/func_math.test
@@ -589,6 +589,44 @@ INSERT INTO t1 VALUES (1),(2);
SELECT STDDEV_SAMP(ROUND('0', 309)) FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal
+--echo #
+
+--echo # Testing that dyadic arithmetic operations are symmetric
+--echo # for (+1) and (-1) and produce the same length in CONCAT(),
+--echo # because (+1) and (-1) have the same data type: signed int.
+
+CREATE TABLE t1 AS SELECT
+ CONCAT(+1%2.0),
+ CONCAT(-1%2.0),
+ CONCAT(+1/2.0),
+ CONCAT(-1/2.0),
+ CONCAT(+1*2.0),
+ CONCAT(-1*2.0),
+ CONCAT(+1+2.0),
+ CONCAT(-1+2.0),
+ CONCAT(+1-2.0),
+ CONCAT(-1-2.0);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT
+ CONCAT(+1%2),
+ CONCAT(-1%2),
+ CONCAT(+1/2),
+ CONCAT(-1/2),
+ CONCAT(+1*2),
+ CONCAT(-1*2),
+ CONCAT(+1+2),
+ CONCAT(-1+2),
+ CONCAT(+1-2),
+ CONCAT(-1-2);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
--echo #
--echo # End of 5.5 tests
--echo #