List:Commits« Previous MessageNext Message »
From:eugene Date:February 9 2007 10:00pm
Subject:bk commit into 5.0 tree (evgen:1.2407) BUG#12122
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-02-10 00:00:07+03:00, evgen@stripped +3 -0
  Bug#12122: The MERGE algorithm isn't applicable if the ORDER BY clause is
  present.
  
  A view created with CREATE VIEW ... ORDER BY ... cannot be resolved with
  the MERGE algorithm, even when no other part of the CREATE VIEW statement
  would require the view to be resolved using the TEMPTABLE algorithm.
  
  The check for presence of the ORDER BY clause in the underlying select is 
  removed from the st_lex::can_be_merged() function.
  The ORDER BY list of the underlying select is appended to the ORDER BY list 

  mysql-test/r/view.result@stripped, 2007-02-09 23:36:42+03:00, evgen@stripped +39 -0
    Added a test case for bug#12122: Views with ORDER BY can't be resolved using MERGE
algorithm.

  mysql-test/t/view.test@stripped, 2007-02-09 23:35:58+03:00, evgen@stripped +14 -0
    Added a test case for bug#12122: Views with ORDER BY can't be resolved using MERGE
algorithm.

  sql/sql_lex.cc@stripped, 2007-02-09 23:59:09+03:00, evgen@stripped +0 -1
    Bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm.
    The st_lex::can_be_merged() function now allows views with the ORDER BY
    clause to be resolved using MERGE algorithm. The ORDER BY list of the view 
    is appended to the ORDER BY list of the embedding select.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/mnt/gentoo64/work/12122-bug-5.0-opt-mysql

--- 1.210/sql/sql_lex.cc	2007-01-23 13:04:15 +03:00
+++ 1.211/sql/sql_lex.cc	2007-02-09 23:59:09 +03:00
@@ -1751,7 +1751,6 @@
   }
 
   return (selects_allow_merge &&
-	  select_lex.order_list.elements == 0 &&
 	  select_lex.group_list.elements == 0 &&
 	  select_lex.having == 0 &&
           select_lex.with_sum_func == 0 &&

--- 1.189/mysql-test/r/view.result	2007-02-08 01:41:54 +03:00
+++ 1.190/mysql-test/r/view.result	2007-02-09 23:36:42 +03:00
@@ -3078,4 +3078,43 @@
 2
 DROP VIEW v1;
 DROP TABLE t1,t2;
+create table t1(f1 int, f2 int);
+insert into t1 values(1,2),(1,3),(1,1),(2,3),(2,1),(2,2);
+select * from t1;
+f1	f2
+1	2
+1	3
+1	1
+2	3
+2	1
+2	2
+create view v1 as select * from t1 order by f2;
+select * from v1;
+f1	f2
+1	1
+2	1
+1	2
+2	2
+1	3
+2	3
+explain extended select * from v1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	6	Using filesort
+Warnings:
+Note	1003	select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order
by `test`.`t1`.`f2`
+select * from v1 order by f1;
+f1	f2
+1	1
+1	2
+1	3
+2	1
+2	2
+2	3
+explain extended select * from v1 order by f1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	6	Using filesort
+Warnings:
+Note	1003	select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order
by `test`.`t1`.`f1`,`test`.`t1`.`f2`
+drop view v1;
+drop table t1;
 End of 5.0 tests.

--- 1.174/mysql-test/t/view.test	2007-02-08 01:41:54 +03:00
+++ 1.175/mysql-test/t/view.test	2007-02-09 23:35:58 +03:00
@@ -3024,4 +3024,18 @@
 DROP VIEW v1;
 DROP TABLE t1,t2;
 
+#
+# Bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm.
+#
+create table t1(f1 int, f2 int);
+insert into t1 values(1,2),(1,3),(1,1),(2,3),(2,1),(2,2);
+select * from t1;
+create view v1 as select * from t1 order by f2;
+select * from v1;
+explain extended select * from v1;
+select * from v1 order by f1;
+explain extended select * from v1 order by f1;
+drop view v1;
+drop table t1;
+
 --echo End of 5.0 tests.
Thread
bk commit into 5.0 tree (evgen:1.2407) BUG#12122eugene9 Feb