List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:September 21 2009 1:00pm
Subject:bzr push into mysql-6.0-bugfixing branch (tor.didriksen:2828 to 2829)
Bug#46860
View as plain text  
 2829 Tor Didriksen	2009-09-21
      Bug #46860 Crash/segfault using EXPLAIN EXTENDED on query using UNION in subquery
      
      EXPLAIN EXTENDED <query> will not generate a Note with extended information
      if EXPLAIN <query> returns an error.
     @ mysql-test/r/explain.result
        Add testcase based on bug report.
     @ mysql-test/r/subselect3.result
        Remove the extended Note, since explain returns error.
     @ mysql-test/r/subselect3_jcl6.result
        Remove the extended Note, since explain returns error.
     @ mysql-test/t/explain.test
        Add testcase based on bug report.
     @ sql/sql_parse.cc
        Skip the extended description if we have an error.

    modified:
      mysql-test/r/explain.result
      mysql-test/r/subselect3.result
      mysql-test/r/subselect3_jcl6.result
      mysql-test/t/explain.test
      sql/sql_parse.cc
 2828 Tor Didriksen	2009-09-21 [merge]
      Bug#46606  	Casting error for large numbers in 5.4 when 'div' is used
      
      DIV queries which are out of range will generate an error: Error (Code 1264): Out of range value
      Prior to this fix, they would also generate an: Error (Code 1041): Out of memory; 
     @ mysql-test/r/func_math.result
        Use SHOW WARNINGS to verify the expected warnings/errors.
     @ mysql-test/t/func_math.test
        Use SHOW WARNINGS to verify the expected warnings/errors.
     @ sql/protocol.cc
        Item::send() may generate an error.
        If so, abort the loop without generating the ER_OUT_OF_RESOURCES error.

    modified:
      mysql-test/r/func_math.result
      mysql-test/t/func_math.test
      sql/protocol.cc
=== modified file 'mysql-test/r/explain.result'
--- a/mysql-test/r/explain.result	2009-09-04 08:14:01 +0000
+++ b/mysql-test/r/explain.result	2009-09-21 12:56:38 +0000
@@ -213,3 +213,14 @@ def					Extra	253	255	14	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 End of 5.2 tests.
+#
+# Bug#46860: 
+# Crash/segfault using EXPLAIN EXTENDED on query using UNION in subquery.
+#
+drop table if exists t1;
+create table `t1` (`a` int);
+explain extended select 1 from `t1`, `t1` as `t2`
+where `t1`.`a`  > all ( (select `a` from `t1` ) union (select `a`) );
+ERROR 23000: Column 'a' in field list is ambiguous
+drop table t1;
+End of 6.0 tests.

=== modified file 'mysql-test/r/subselect3.result'
--- a/mysql-test/r/subselect3.result	2009-09-16 08:23:16 +0000
+++ b/mysql-test/r/subselect3.result	2009-09-21 12:56:38 +0000
@@ -873,9 +873,6 @@ Level	Code	Message
 Note	1276	Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
 Note	1276	Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
 Error	1054	Unknown column 'c' in 'field list'
-Note	1003	select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `c`) AS `(SELECT COUNT(a) FROM 
-(SELECT COUNT(b) FROM t1) AS x GROUP BY c
-)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
 DROP TABLE t1;
 End of 5.0 tests
 #  

=== modified file 'mysql-test/r/subselect3_jcl6.result'
--- a/mysql-test/r/subselect3_jcl6.result	2009-04-30 19:37:21 +0000
+++ b/mysql-test/r/subselect3_jcl6.result	2009-09-21 12:56:38 +0000
@@ -877,9 +877,6 @@ Level	Code	Message
 Note	1276	Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
 Note	1276	Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
 Error	1054	Unknown column 'c' in 'field list'
-Note	1003	select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `c`) AS `(SELECT COUNT(a) FROM 
-(SELECT COUNT(b) FROM t1) AS x GROUP BY c
-)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
 DROP TABLE t1;
 End of 5.0 tests
 #  

=== modified file 'mysql-test/t/explain.test'
--- a/mysql-test/t/explain.test	2009-09-04 08:14:01 +0000
+++ b/mysql-test/t/explain.test	2009-09-21 12:56:38 +0000
@@ -1,5 +1,5 @@
 #
-# Test of different EXPLAIN's
+# Test of different EXPLAINs
 
 --disable_warnings
 drop table if exists t1;
@@ -175,3 +175,18 @@ explain select 1;
 --disable_metadata
 
 --echo End of 5.2 tests.
+
+--echo #
+--echo # Bug#46860: 
+--echo # Crash/segfault using EXPLAIN EXTENDED on query using UNION in subquery.
+--echo #
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table `t1` (`a` int);
+--error ER_NON_UNIQ_ERROR
+explain extended select 1 from `t1`, `t1` as `t2`
+where `t1`.`a`  > all ( (select `a` from `t1` ) union (select `a`) );
+drop table t1;
+
+--echo End of 6.0 tests.

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-09-16 15:43:00 +0000
+++ b/sql/sql_parse.cc	2009-09-21 12:56:38 +0000
@@ -4948,7 +4948,11 @@ static bool execute_sqlcom_select(THD *t
         return 1;                               /* purecov: inspected */
       thd->send_explain_fields(result);
       res= mysql_explain_union(thd, &thd->lex->unit, result);
-      if (lex->describe & DESCRIBE_EXTENDED)
+      /*
+        The code which prints the extended description is not robust
+        against malformed queries, so skip it if we have an error.
+      */
+      if (!res && (lex->describe & DESCRIBE_EXTENDED))
       {
         char buff[1024];
         String str(buff,(uint32) sizeof(buff), system_charset_info);


Attachment: [text/bzr-bundle] bzr/tor.didriksen@sun.com-20090921125638-vwidsxe77gf16qkl.bundle
Thread
bzr push into mysql-6.0-bugfixing branch (tor.didriksen:2828 to 2829)Bug#46860Tor Didriksen21 Sep