diff options
Diffstat (limited to 'mysql-test/main/view.test')
-rw-r--r-- | mysql-test/main/view.test | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 47ede54e1c7..1429642b0ab 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -6485,6 +6485,22 @@ DROP VIEW v1; DROP TABLE t1, t2; --echo # +--echo # MDEV-23291: SUM column from a derived table returns invalid values +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,1), (2,2); + +CREATE view v1 AS +SELECT a as x, (select x) as y, (select y) as z FROM t1; + +SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q; +SELECT sum(z) FROM v1; + +DROP TABLE t1; +DROP VIEW v1; + +--echo # --echo # End of 10.2 tests --echo # |