List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 25 2010 1:34pm
Subject:bzr push into mysql-trunk branch (Georgi.Kodinov:3079 to 3080)
View as plain text  
 3080 Georgi Kodinov	2010-06-25 [merge]
      merge

    modified:
      mysql-test/r/subselect.result
      mysql-test/t/subselect.test
      sql/sql_select.cc
 3079 Sergey Glukhov	2010-06-25 [merge]
      5.1-bugteam->trunk-merge merge
     @ mysql-test/r/information_schema.result
        5.1-bugteam->trunk-merge merge
     @ mysql-test/t/information_schema.test
        5.1-bugteam->trunk-merge merge
     @ sql/sql_show.cc
        5.1-bugteam->trunk-merge merge

    modified:
      mysql-test/r/information_schema.result
      mysql-test/t/information_schema.test
      sql/sql_show.cc
=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result	2010-04-29 20:33:06 +0000
+++ b/mysql-test/r/subselect.result	2010-06-25 13:32:47 +0000
@@ -4988,3 +4988,20 @@ t1_id	total_amount
 DROP TABLE t3;
 DROP TABLE t2;
 DROP TABLE t1;
+#
+# Bug #52711: Segfault when doing EXPLAIN SELECT with 
+#  union...order by (select... where...)
+#
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+# Should not crash
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+# Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+End of 5.1 tests

=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test	2010-04-29 20:33:06 +0000
+++ b/mysql-test/t/subselect.test	2010-06-25 13:32:47 +0000
@@ -3921,3 +3921,28 @@ GROUP BY
 DROP TABLE t3;
 DROP TABLE t2;
 DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with 
+--echo #  union...order by (select... where...)
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+
+--echo # Should not crash
+--disable_result_log
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+  ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+
+--echo # Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+  ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+--enable_result_log
+
+--echo End of 5.1 tests

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-06-24 08:34:05 +0000
+++ b/sql/sql_select.cc	2010-06-25 13:32:47 +0000
@@ -7358,7 +7358,8 @@ remove_const(JOIN *join,ORDER *first_ord
       *simple_order=0;				// Must do a temp table to sort
     else if (!(order_tables & not_const_tables))
     {
-      if (order->item[0]->with_subselect)
+      if (order->item[0]->with_subselect && 
+          !(join->select_lex->options & SELECT_DESCRIBE))
         order->item[0]->val_str(&order->item[0]->str_value);
       DBUG_PRINT("info",("removing: %s", order->item[0]->full_name()));
       continue;					// skip const item


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100625133247-lc6rhihohujrad8q.bundle
Thread
bzr push into mysql-trunk branch (Georgi.Kodinov:3079 to 3080) Georgi Kodinov25 Jun