summaryrefslogtreecommitdiff
path: root/mysql-test/r/group_by.result
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@askmonty.org>2012-05-02 18:11:02 +0200
committerOleksandr Byelkin <sanja@askmonty.org>2012-05-02 18:11:02 +0200
commit8fe40c50db3445ce7b9485ddcdc3893ef0250652 (patch)
treee042fe3fea5848c1e0482f27688f0e6ca73d9d7c /mysql-test/r/group_by.result
parentb192f7a2e7689e67427e55ed8b01926cc1fa9f37 (diff)
downloadmariadb-git-8fe40c50db3445ce7b9485ddcdc3893ef0250652.tar.gz
MDEV-214 lp:967242 Wrong result with JOIN, AND in ON condition, multi-part key, GROUP BY, subquery and OR in WHERE
The problem was in the code (update_const_equal_items()) which marked index parts constant independently of the place where the equality was used. In the test suite it marked t2_1.c part constant despite the fact that it connected by OR with other expression. Solution is to mark constant only top equalities connected with AND.
Diffstat (limited to 'mysql-test/r/group_by.result')
-rw-r--r--mysql-test/r/group_by.result47
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index d322952af2b..5a3fc7a337c 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1958,4 +1958,51 @@ field1 field2
2009-02-19 02:05:00 5
SET SESSION SQL_MODE=default;
drop table t1;
+#
+# LP bug#967242 Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE
+#
+CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('x');
+CREATE TABLE t2 ( b INT, c VARCHAR(1), KEY (c, b) ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+(4, 'd'),(8, 'g'),(3, 'x'),(3, 'f'),
+(0, 'p'),(3, 'j'),(8, 'c');
+SELECT t2_1.b as zzz
+FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
+ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
+WHERE
+rand() + 1 > 0 OR
+a = t2_1.c
+GROUP BY zzz;
+zzz
+0
+3
+4
+8
+SELECT t2_1.b as zzz
+FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
+ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
+WHERE
+1 > 0 OR
+a = t2_1.c
+GROUP BY zzz;
+zzz
+0
+3
+4
+8
+SELECT t2_1.b as zzz
+FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
+ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
+WHERE
+t2_1.b + 1 > 0 OR
+a = t2_1.c
+GROUP BY zzz;
+zzz
+0
+3
+4
+8
+#TODO: in merge with 5.3 add original test suite
+drop table t1, t2;
# End of 5.2 tests