From: Date: October 12 2005 1:32am Subject: bk commit into 4.1 tree (evgen:1.2457) BUG#7672 List-Archive: http://lists.mysql.com/internals/30983 X-Bug: 7672 Message-Id: <20051011233220.C3A8513E7E2@localhost.moonbone.local> Below is the list of changes that have just been committed into a local 4.1 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 1.2457 05/10/12 03:32:14 evgen@stripped +6 -0 Manual merge, fix for bug #7672 sql/sql_select.cc 1.438 05/10/12 03:32:13 evgen@stripped +0 -6 Manual merge sql/sql_lex.h 1.187 05/10/12 03:32:13 evgen@stripped +1 -1 Manual merge sql/sql_lex.cc 1.150 05/10/12 03:32:13 evgen@stripped +0 -0 Manual merge sql/item.cc 1.222 05/10/12 03:32:13 evgen@stripped +6 -7 Manual merge mysql-test/t/select.test 1.47 05/10/12 03:32:13 evgen@stripped +1 -1 Manual merge mysql-test/r/select.result 1.63 05/10/12 03:32:13 evgen@stripped +10 -10 Manual merge # 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: /work/7672-bug-4.1-mysql/RESYNC --- 1.221/sql/item.cc 2005-09-09 12:22:12 +04:00 +++ 1.222/sql/item.cc 2005-10-12 03:32:13 +04:00 @@ -1760,6 +1760,16 @@ if ((tmp= find_field_in_tables(thd, this, tables, &where, 0)) == not_found_field) { + if (thd->lex.select_lex.is_item_list_lookup) + { + Item** res= find_item_in_list(this, thd->lex.select_lex.item_list); + if (res && *res && (*res)->type() == Item::FIELD_ITEM) + { + set_field((*((Item_field**)res))->field); + return 0; + } + } + /* We can't find table field in table list of current select, consequently we have to find it in outer subselect(s). --- 1.149/sql/sql_lex.cc 2005-09-25 22:22:20 +04:00 +++ 1.150/sql/sql_lex.cc 2005-10-12 03:32:13 +04:00 @@ -160,6 +160,7 @@ lex->duplicates= DUP_ERROR; lex->ignore= 0; lex->proc_list.first= 0; + lex->select_lex.is_item_list_lookup= 0; } void lex_end(LEX *lex) --- 1.186/sql/sql_lex.h 2005-09-19 17:35:04 +04:00 +++ 1.187/sql/sql_lex.h 2005-10-12 03:32:13 +04:00 @@ -426,6 +426,7 @@ List item_list; /* list of fields & expressions */ List interval_list, use_index, *use_index_ptr, ignore_index, *ignore_index_ptr; + bool is_item_list_lookup; /* Usualy it is pointer to ftfunc_list_alloc, but in union used to create fake select_lex for calling mysql_select under results of union --- 1.62/mysql-test/r/select.result 2005-07-19 20:24:58 +04:00 +++ 1.63/mysql-test/r/select.result 2005-10-12 03:32:13 +04:00 @@ -2617,3 +2617,13 @@ found_rows() 1 DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT); +(SELECT a, b AS c FROM t1) ORDER BY c+1; +a c +(SELECT a, b AS c FROM t1) ORDER BY b+1; +a c +SELECT a, b AS c FROM t1 ORDER BY c+1; +a c +SELECT a, b AS c FROM t1 ORDER BY b+1; +a c +drop table t1; --- 1.46/mysql-test/t/select.test 2005-07-28 04:21:49 +04:00 +++ 1.47/mysql-test/t/select.test 2005-10-12 03:32:13 +04:00 @@ -2053,6 +2053,7 @@ drop table t1; # +# # Test for Bug#8009, SELECT failed on bigint unsigned when using HEX # @@ -2165,3 +2166,11 @@ DROP TABLE t1; # End of 4.1 tests +# Bug 7672 Unknown column error in order clause +# +CREATE TABLE t1 (a INT, b INT); +(SELECT a, b AS c FROM t1) ORDER BY c+1; +(SELECT a, b AS c FROM t1) ORDER BY b+1; +SELECT a, b AS c FROM t1 ORDER BY c+1; +SELECT a, b AS c FROM t1 ORDER BY b+1; +drop table t1;