Loading mysql-test/r/view.result +10 −0 Original line number Diff line number Diff line Loading @@ -2286,5 +2286,15 @@ SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1; a 2 3 SELECT t_1.a FROM t1 AS t_1 GROUP BY t_1.a HAVING t_1.a IN (1,2,3); a 1 2 3 SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3); a 1 2 3 DROP VIEW v1; DROP TABLE t1; mysql-test/t/view.test +2 −0 Original line number Diff line number Diff line Loading @@ -2162,6 +2162,8 @@ INSERT INTO t1 VALUES (1,1),(2,2),(3,3); CREATE VIEW v1 AS SELECT a,b FROM t1; SELECT t1.a FROM t1 GROUP BY t1.a HAVING t1.a > 1; SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1; SELECT t_1.a FROM t1 AS t_1 GROUP BY t_1.a HAVING t_1.a IN (1,2,3); SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3); DROP VIEW v1; DROP TABLE t1; sql/item.cc +2 −2 Original line number Diff line number Diff line Loading @@ -2973,7 +2973,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) const char *field_name; ORDER *found_group= NULL; int found_match_degree= 0; Item_field *cur_field; Item_ident *cur_field; int cur_match_degree= 0; if (find_item->type() == Item::FIELD_ITEM || Loading @@ -2992,7 +2992,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) { if ((*(cur_group->item))->real_item()->type() == Item::FIELD_ITEM) { cur_field= (Item_field*) *cur_group->item; cur_field= (Item_ident*) *cur_group->item; cur_match_degree= 0; DBUG_ASSERT(cur_field->field_name != 0); Loading sql/item.h +1 −1 Original line number Diff line number Diff line Loading @@ -1622,7 +1622,7 @@ class Item_ref :public Item_ident } Item *real_item() { return (*ref)->real_item(); return (ref && *ref) ? (*ref)->real_item() : this; } bool walk(Item_processor processor, byte *arg) { return (*ref)->walk(processor, arg); } Loading sql/sql_base.cc +2 −2 Original line number Diff line number Diff line Loading @@ -3353,9 +3353,9 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter, for (uint i= 0; (item=li++); i++) { if (field_name && item->type() == Item::FIELD_ITEM) if (field_name && item->real_item()->type() == Item::FIELD_ITEM) { Item_field *item_field= (Item_field*) item; Item_ident *item_field= (Item_ident*) item; /* In case of group_concat() with ORDER BY condition in the QUERY Loading Loading
mysql-test/r/view.result +10 −0 Original line number Diff line number Diff line Loading @@ -2286,5 +2286,15 @@ SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1; a 2 3 SELECT t_1.a FROM t1 AS t_1 GROUP BY t_1.a HAVING t_1.a IN (1,2,3); a 1 2 3 SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3); a 1 2 3 DROP VIEW v1; DROP TABLE t1;
mysql-test/t/view.test +2 −0 Original line number Diff line number Diff line Loading @@ -2162,6 +2162,8 @@ INSERT INTO t1 VALUES (1,1),(2,2),(3,3); CREATE VIEW v1 AS SELECT a,b FROM t1; SELECT t1.a FROM t1 GROUP BY t1.a HAVING t1.a > 1; SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1; SELECT t_1.a FROM t1 AS t_1 GROUP BY t_1.a HAVING t_1.a IN (1,2,3); SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3); DROP VIEW v1; DROP TABLE t1;
sql/item.cc +2 −2 Original line number Diff line number Diff line Loading @@ -2973,7 +2973,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) const char *field_name; ORDER *found_group= NULL; int found_match_degree= 0; Item_field *cur_field; Item_ident *cur_field; int cur_match_degree= 0; if (find_item->type() == Item::FIELD_ITEM || Loading @@ -2992,7 +2992,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) { if ((*(cur_group->item))->real_item()->type() == Item::FIELD_ITEM) { cur_field= (Item_field*) *cur_group->item; cur_field= (Item_ident*) *cur_group->item; cur_match_degree= 0; DBUG_ASSERT(cur_field->field_name != 0); Loading
sql/item.h +1 −1 Original line number Diff line number Diff line Loading @@ -1622,7 +1622,7 @@ class Item_ref :public Item_ident } Item *real_item() { return (*ref)->real_item(); return (ref && *ref) ? (*ref)->real_item() : this; } bool walk(Item_processor processor, byte *arg) { return (*ref)->walk(processor, arg); } Loading
sql/sql_base.cc +2 −2 Original line number Diff line number Diff line Loading @@ -3353,9 +3353,9 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter, for (uint i= 0; (item=li++); i++) { if (field_name && item->type() == Item::FIELD_ITEM) if (field_name && item->real_item()->type() == Item::FIELD_ITEM) { Item_field *item_field= (Item_field*) item; Item_ident *item_field= (Item_ident*) item; /* In case of group_concat() with ORDER BY condition in the QUERY Loading