Loading mysql-test/r/select.result +10 −0 Original line number Diff line number Diff line Loading @@ -2617,6 +2617,16 @@ select found_rows(); 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; create table t1(f1 int, f2 int); create table t2(f3 int); select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1)); Loading mysql-test/t/select.test +11 −0 Original line number Diff line number Diff line Loading @@ -2052,6 +2052,7 @@ AND FK_firma_id = 2; drop table t1; # # # Test for Bug#8009, SELECT failed on bigint unsigned when using HEX # Loading Loading @@ -2164,6 +2165,16 @@ select found_rows(); DROP TABLE t1; # # 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; # # Bug #13356 assertion failed in resolve_const_item() # Loading sql/item.cc +15 −0 Original line number Diff line number Diff line Loading @@ -1760,6 +1760,21 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) if ((tmp= find_field_in_tables(thd, this, tables, &where, 0)) == not_found_field) { /* Look up in current select's item_list to find aliased fields */ if (thd->lex->current_select->is_item_list_lookup) { uint counter; bool not_used; Item** res= find_item_in_list(this, thd->lex->current_select->item_list, &counter, REPORT_EXCEPT_NOT_FOUND, ¬_used); if (res != not_found_item && (*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). Loading sql/sql_lex.cc +2 −0 Original line number Diff line number Diff line Loading @@ -1083,6 +1083,7 @@ void st_select_lex::init_query() prep_where= 0; subquery_in_having= explicit_limit= 0; parsing_place= NO_MATTER; is_item_list_lookup= 0; } void st_select_lex::init_select() Loading @@ -1109,6 +1110,7 @@ void st_select_lex::init_select() select_limit= HA_POS_ERROR; offset_limit= 0; with_sum_func= 0; } /* Loading sql/sql_lex.h +1 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,7 @@ class st_select_lex: public st_select_lex_node List<Item> item_list; /* list of fields & expressions */ List<String> 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 Loading Loading
mysql-test/r/select.result +10 −0 Original line number Diff line number Diff line Loading @@ -2617,6 +2617,16 @@ select found_rows(); 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; create table t1(f1 int, f2 int); create table t2(f3 int); select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1)); Loading
mysql-test/t/select.test +11 −0 Original line number Diff line number Diff line Loading @@ -2052,6 +2052,7 @@ AND FK_firma_id = 2; drop table t1; # # # Test for Bug#8009, SELECT failed on bigint unsigned when using HEX # Loading Loading @@ -2164,6 +2165,16 @@ select found_rows(); DROP TABLE t1; # # 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; # # Bug #13356 assertion failed in resolve_const_item() # Loading
sql/item.cc +15 −0 Original line number Diff line number Diff line Loading @@ -1760,6 +1760,21 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) if ((tmp= find_field_in_tables(thd, this, tables, &where, 0)) == not_found_field) { /* Look up in current select's item_list to find aliased fields */ if (thd->lex->current_select->is_item_list_lookup) { uint counter; bool not_used; Item** res= find_item_in_list(this, thd->lex->current_select->item_list, &counter, REPORT_EXCEPT_NOT_FOUND, ¬_used); if (res != not_found_item && (*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). Loading
sql/sql_lex.cc +2 −0 Original line number Diff line number Diff line Loading @@ -1083,6 +1083,7 @@ void st_select_lex::init_query() prep_where= 0; subquery_in_having= explicit_limit= 0; parsing_place= NO_MATTER; is_item_list_lookup= 0; } void st_select_lex::init_select() Loading @@ -1109,6 +1110,7 @@ void st_select_lex::init_select() select_limit= HA_POS_ERROR; offset_limit= 0; with_sum_func= 0; } /* Loading
sql/sql_lex.h +1 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,7 @@ class st_select_lex: public st_select_lex_node List<Item> item_list; /* list of fields & expressions */ List<String> 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 Loading