1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal

Also fixes:

MDEV-20560 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with MOD short unsigned decimal

Changing the way how Item_func_mod calculates its max_length.
It now uses decimal_precision(), decimal_scale() and unsigned_flag
of its arguments, like all other Item_num_op descendants do.
This commit is contained in:
Alexander Barkov
2019-09-24 10:46:18 +04:00
parent fd3ad41eed
commit 67b0faa29e
11 changed files with 222 additions and 7 deletions

View File

@ -771,5 +771,63 @@ STDDEV_SAMP(ROUND('0', 309))
0
DROP TABLE t1;
#
# MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal
#
# Testing that dyadic arithmetic operations are symmetric
# for (+1) and (-1) and produce the same length in CONCAT(),
# 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;
Table Create Table
t1 CREATE TABLE `t1` (
`CONCAT(+1%2.0)` varchar(4) DEFAULT NULL,
`CONCAT(-1%2.0)` varchar(4) DEFAULT NULL,
`CONCAT(+1/2.0)` varchar(8) DEFAULT NULL,
`CONCAT(-1/2.0)` varchar(8) DEFAULT NULL,
`CONCAT(+1*2.0)` varchar(5) NOT NULL DEFAULT '',
`CONCAT(-1*2.0)` varchar(5) NOT NULL DEFAULT '',
`CONCAT(+1+2.0)` varchar(5) NOT NULL DEFAULT '',
`CONCAT(-1+2.0)` varchar(5) NOT NULL DEFAULT '',
`CONCAT(+1-2.0)` varchar(5) NOT NULL DEFAULT '',
`CONCAT(-1-2.0)` varchar(5) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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;
Table Create Table
t1 CREATE TABLE `t1` (
`CONCAT(+1%2)` varchar(2) DEFAULT NULL,
`CONCAT(-1%2)` varchar(2) DEFAULT NULL,
`CONCAT(+1/2)` varchar(7) DEFAULT NULL,
`CONCAT(-1/2)` varchar(7) DEFAULT NULL,
`CONCAT(+1*2)` varchar(3) NOT NULL DEFAULT '',
`CONCAT(-1*2)` varchar(3) NOT NULL DEFAULT '',
`CONCAT(+1+2)` varchar(3) NOT NULL DEFAULT '',
`CONCAT(-1+2)` varchar(3) NOT NULL DEFAULT '',
`CONCAT(+1-2)` varchar(3) NOT NULL DEFAULT '',
`CONCAT(-1-2)` varchar(3) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# End of 5.5 tests
#