summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-10-12 21:40:56 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-10-12 21:40:56 +0400
commit88d8fccfca933a2f359d6f31277b787dd6c6fc55 (patch)
tree137b448127aa98322a29fc1862750b8e262a8f5e
parentae79dbdb958ba49cff46a7b104bf1011b23c3788 (diff)
downloadmariadb-git-88d8fccfca933a2f359d6f31277b787dd6c6fc55.tar.gz
BUG#872702: Crash in add_ref_to_table_cond() when grouping by a PK
- Testcase
-rw-r--r--mysql-test/r/group_by.result15
-rw-r--r--mysql-test/t/group_by.test18
2 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index b2cecb57b3c..770c0f088a2 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1909,3 +1909,18 @@ a AVG(t1.b) t11c t12c
2 2.0000 7 7
DROP TABLE t1;
# End of 5.1 tests
+#
+# BUG#872702: Crash in add_ref_to_table_cond() when grouping by a PK
+#
+CREATE TABLE t1 (a int, PRIMARY KEY (a)) ;
+INSERT INTO t1 VALUES (14),(15),(16),(17),(18),(19),(20);
+CREATE TABLE t2 (a int) ;
+SELECT a
+FROM t1
+WHERE a = (
+SELECT t2.a
+FROM t2
+) OR t1.a = 73
+GROUP BY 1;
+a
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 44af2ca27a2..cf648fd9b9d 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1302,3 +1302,21 @@ DROP TABLE t1;
--echo # End of 5.1 tests
+
+--echo #
+--echo # BUG#872702: Crash in add_ref_to_table_cond() when grouping by a PK
+--echo #
+CREATE TABLE t1 (a int, PRIMARY KEY (a)) ;
+INSERT INTO t1 VALUES (14),(15),(16),(17),(18),(19),(20);
+
+CREATE TABLE t2 (a int) ;
+
+SELECT a
+FROM t1
+WHERE a = (
+ SELECT t2.a
+ FROM t2
+) OR t1.a = 73
+GROUP BY 1;
+DROP TABLE t1, t2;
+