summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2014-09-23 13:57:29 +0300
committerMichael Widenius <monty@mariadb.org>2014-09-23 13:57:29 +0300
commitbab638d842a8a561b9287f4b32a5848069c134f3 (patch)
tree30ba324e0442800d4d9aba80e2bd866c61e3db9f /mysql-test/r
parente41bca0066ddcda39b5a3eef17deae066cd113d9 (diff)
downloadmariadb-git-bab638d842a8a561b9287f4b32a5848069c134f3.tar.gz
MDEV-6743 crash in GROUP_CONCAT(IF () ORDER BY 1)
mysql-test/r/func_group.result: Test case mysql-test/t/func_group.test: Test case sql/item_sum.cc: Restore ORDER for prepared statements
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/func_group.result33
1 files changed, 32 insertions, 1 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 8e2bdeae93c..ac076ec4348 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3,t4,t5,t6;
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
show variables like 'div_precision_increment';
@@ -2239,3 +2239,34 @@ explain select MIN(b) from t1 where b >= inet_aton('192.168.119.32');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
DROP TABLE t1;
+#
+# MDEV-6743 crash in GROUP_CONCAT(IF () ORDER BY 1)
+#
+CREATE TABLE t1 (pk INT, t2_id INT, t5_id INT, PRIMARY KEY (pk));
+INSERT INTO t1 VALUES (1,3,12),(2,3,15);
+CREATE TABLE t2 (pk INT, PRIMARY KEY (pk));
+INSERT INTO t2 VALUES (4),(5);
+CREATE TABLE t3 (t2_id INT, t4_id INT);
+INSERT INTO t3 VALUES (6,11),(7,12);
+CREATE TABLE t4 (id INT);
+INSERT INTO t4 VALUES (13),(14);
+CREATE TABLE t5 (pk INT, f VARCHAR(50), t6_id INT, PRIMARY KEY (pk));
+INSERT INTO t5 VALUES (9,'FOO',NULL);
+CREATE TABLE t6 (pk INT, f VARCHAR(120), b TINYINT(4), PRIMARY KEY (pk));
+PREPARE stmt FROM "
+ SELECT t1.t2_id, GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1)
+ FROM t1
+ JOIN t2 ON t1.t2_id = t2.pk
+ JOIN t3 ON t2.pk = t3.t2_id
+ JOIN t4 ON t4.id = t3.t4_id
+ JOIN t5 ON t1.t5_id = t5.pk
+ LEFT JOIN t6 ON t6.pk = t5.t6_id
+ GROUP BY t1.t2_id
+";
+EXECUTE stmt;
+t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1)
+EXECUTE stmt;
+t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1)
+EXECUTE stmt;
+t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1)
+DROP TABLE t1,t2,t3,t4,t5,t6;