mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result
This problem was earlier fixed by the patch for MDEV 33344. Adding a test case only.
This commit is contained in:
@ -178,4 +178,18 @@ select 'foo' regexp x from t1 order by x desc;
|
|||||||
0
|
0
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result
|
||||||
|
#
|
||||||
|
CREATE TABLE t0(c0 INT NOT NULL, c1 CHAR UNIQUE);
|
||||||
|
INSERT INTO t0 VALUES (0, 1);
|
||||||
|
INSERT INTO t0 VALUES (0, '');
|
||||||
|
SELECT (c1 RLIKE c1), (c0 IS NULL) FROM t0;
|
||||||
|
(c1 RLIKE c1) (c0 IS NULL)
|
||||||
|
1 0
|
||||||
|
1 0
|
||||||
|
SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a;
|
||||||
|
SUM(a.t)
|
||||||
|
0
|
||||||
|
DROP TABLE t0;
|
||||||
# End of 10.5 tests
|
# End of 10.5 tests
|
||||||
|
@ -121,4 +121,16 @@ select 'foo' regexp x from t1 order by x asc;
|
|||||||
select 'foo' regexp x from t1 order by x desc;
|
select 'foo' regexp x from t1 order by x desc;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t0(c0 INT NOT NULL, c1 CHAR UNIQUE);
|
||||||
|
INSERT INTO t0 VALUES (0, 1);
|
||||||
|
INSERT INTO t0 VALUES (0, '');
|
||||||
|
SELECT (c1 RLIKE c1), (c0 IS NULL) FROM t0;
|
||||||
|
SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a;
|
||||||
|
DROP TABLE t0;
|
||||||
|
|
||||||
|
|
||||||
--echo # End of 10.5 tests
|
--echo # End of 10.5 tests
|
||||||
|
Reference in New Issue
Block a user