Commit 578d8bfd authored by Alexander Barkov's avatar Alexander Barkov

Additional tests for MDEV-10309 COALESCE(12345678900) makes a column of a...

Additional tests for MDEV-10309 COALESCE(12345678900) makes a column of a wrong type and truncates the data
parent 43eec57f
......@@ -3570,6 +3570,153 @@ t1 CREATE TABLE `t1` (
`c2` bigint(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
9 AS i1, COALESCE(9) AS c1,
99 AS i2, COALESCE(99) AS c2,
999 AS i3, COALESCE(999) AS c3,
9999 AS i4, COALESCE(9999) AS c4,
99999 AS i5, COALESCE(99999) AS c5,
999999 AS i6, COALESCE(999999) AS c6,
9999999 AS i7, COALESCE(9999999) AS c7,
99999999 AS i8, COALESCE(99999999) AS c8,
999999999 AS i9, COALESCE(999999999) AS c9,
2147483647, COALESCE(2147483647),
2147483648, COALESCE(2147483648),
9999999999 AS i10, COALESCE(9999999999) AS c10,
99999999999 AS i11, COALESCE(99999999999) AS c11,
999999999999 AS i12, COALESCE(999999999999) AS c12,
9999999999999 AS i13, COALESCE(9999999999999) AS c13,
99999999999999 AS i14, COALESCE(99999999999999) AS c14,
999999999999999 AS i15, COALESCE(999999999999999) AS c15,
9999999999999999 AS i16, COALESCE(9999999999999999) AS c16,
99999999999999999 AS i17, COALESCE(99999999999999999) AS c17,
999999999999999999 AS i18, COALESCE(999999999999999999) AS c18,
9223372036854775807, COALESCE(9223372036854775807),
9223372036854775808, COALESCE(9223372036854775808),
9999999999999999999 AS i19, COALESCE(9999999999999999999) AS c19,
18446744073709551615, COALESCE(18446744073709551615),
18446744073709551616, COALESCE(18446744073709551616),
99999999999999999999 AS i20, COALESCE(99999999999999999999) AS c20,
999999999999999999999 AS i21, COALESCE(999999999999999999999) AS c21,
9999999999999999999999 AS i22, COALESCE(9999999999999999999999) AS c22;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i1` int(1) NOT NULL,
`c1` int(1) NOT NULL,
`i2` int(2) NOT NULL,
`c2` int(2) NOT NULL,
`i3` int(3) NOT NULL,
`c3` int(3) NOT NULL,
`i4` int(4) NOT NULL,
`c4` int(4) NOT NULL,
`i5` int(5) NOT NULL,
`c5` int(5) NOT NULL,
`i6` int(6) NOT NULL,
`c6` int(6) NOT NULL,
`i7` int(7) NOT NULL,
`c7` int(7) NOT NULL,
`i8` int(8) NOT NULL,
`c8` int(8) NOT NULL,
`i9` int(9) NOT NULL,
`c9` int(9) NOT NULL,
`2147483647` bigint(10) NOT NULL,
`COALESCE(2147483647)` bigint(10) NOT NULL,
`2147483648` bigint(10) NOT NULL,
`COALESCE(2147483648)` bigint(10) NOT NULL,
`i10` bigint(10) NOT NULL,
`c10` bigint(10) NOT NULL,
`i11` bigint(11) NOT NULL,
`c11` bigint(11) NOT NULL,
`i12` bigint(12) NOT NULL,
`c12` bigint(12) NOT NULL,
`i13` bigint(13) NOT NULL,
`c13` bigint(13) NOT NULL,
`i14` bigint(14) NOT NULL,
`c14` bigint(14) NOT NULL,
`i15` bigint(15) NOT NULL,
`c15` bigint(15) NOT NULL,
`i16` bigint(16) NOT NULL,
`c16` bigint(16) NOT NULL,
`i17` bigint(17) NOT NULL,
`c17` bigint(17) NOT NULL,
`i18` bigint(18) NOT NULL,
`c18` bigint(18) NOT NULL,
`9223372036854775807` bigint(19) NOT NULL,
`COALESCE(9223372036854775807)` bigint(19) NOT NULL,
`9223372036854775808` bigint(19) unsigned NOT NULL,
`COALESCE(9223372036854775808)` bigint(19) unsigned NOT NULL,
`i19` bigint(19) unsigned NOT NULL,
`c19` bigint(19) unsigned NOT NULL,
`18446744073709551615` bigint(20) unsigned NOT NULL,
`COALESCE(18446744073709551615)` bigint(20) unsigned NOT NULL,
`18446744073709551616` decimal(20,0) NOT NULL,
`COALESCE(18446744073709551616)` decimal(20,0) NOT NULL,
`i20` decimal(20,0) NOT NULL,
`c20` decimal(20,0) NOT NULL,
`i21` decimal(21,0) NOT NULL,
`c21` decimal(21,0) NOT NULL,
`i22` decimal(22,0) NOT NULL,
`c22` decimal(22,0) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
i1 9
c1 9
i2 99
c2 99
i3 999
c3 999
i4 9999
c4 9999
i5 99999
c5 99999
i6 999999
c6 999999
i7 9999999
c7 9999999
i8 99999999
c8 99999999
i9 999999999
c9 999999999
2147483647 2147483647
COALESCE(2147483647) 2147483647
2147483648 2147483648
COALESCE(2147483648) 2147483648
i10 9999999999
c10 9999999999
i11 99999999999
c11 99999999999
i12 999999999999
c12 999999999999
i13 9999999999999
c13 9999999999999
i14 99999999999999
c14 99999999999999
i15 999999999999999
c15 999999999999999
i16 9999999999999999
c16 9999999999999999
i17 99999999999999999
c17 99999999999999999
i18 999999999999999999
c18 999999999999999999
9223372036854775807 9223372036854775807
COALESCE(9223372036854775807) 9223372036854775807
9223372036854775808 9223372036854775808
COALESCE(9223372036854775808) 9223372036854775808
i19 9999999999999999999
c19 9999999999999999999
18446744073709551615 18446744073709551615
COALESCE(18446744073709551615) 18446744073709551615
18446744073709551616 18446744073709551616
COALESCE(18446744073709551616) 18446744073709551616
i20 99999999999999999999
c20 99999999999999999999
i21 999999999999999999999
c21 999999999999999999999
i22 9999999999999999999999
c22 9999999999999999999999
DROP TABLE t1;
#
# MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF
#
......
......@@ -553,6 +553,42 @@ SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
9 AS i1, COALESCE(9) AS c1,
99 AS i2, COALESCE(99) AS c2,
999 AS i3, COALESCE(999) AS c3,
9999 AS i4, COALESCE(9999) AS c4,
99999 AS i5, COALESCE(99999) AS c5,
999999 AS i6, COALESCE(999999) AS c6,
9999999 AS i7, COALESCE(9999999) AS c7,
99999999 AS i8, COALESCE(99999999) AS c8,
999999999 AS i9, COALESCE(999999999) AS c9,
2147483647, COALESCE(2147483647),
2147483648, COALESCE(2147483648),
9999999999 AS i10, COALESCE(9999999999) AS c10,
99999999999 AS i11, COALESCE(99999999999) AS c11,
999999999999 AS i12, COALESCE(999999999999) AS c12,
9999999999999 AS i13, COALESCE(9999999999999) AS c13,
99999999999999 AS i14, COALESCE(99999999999999) AS c14,
999999999999999 AS i15, COALESCE(999999999999999) AS c15,
9999999999999999 AS i16, COALESCE(9999999999999999) AS c16,
99999999999999999 AS i17, COALESCE(99999999999999999) AS c17,
999999999999999999 AS i18, COALESCE(999999999999999999) AS c18,
9223372036854775807, COALESCE(9223372036854775807),
9223372036854775808, COALESCE(9223372036854775808),
9999999999999999999 AS i19, COALESCE(9999999999999999999) AS c19,
18446744073709551615, COALESCE(18446744073709551615),
18446744073709551616, COALESCE(18446744073709551616),
99999999999999999999 AS i20, COALESCE(99999999999999999999) AS c20,
999999999999999999999 AS i21, COALESCE(999999999999999999999) AS c21,
9999999999999999999999 AS i22, COALESCE(9999999999999999999999) AS c22;
SHOW CREATE TABLE t1;
--vertical_results
SELECT * FROM t1;
--horizontal_results
DROP TABLE t1;
--echo #
--echo # MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF
--echo #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment