Commit 6e2fb27a authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

item.cc:

  Fixed bug #13410.
  Fixed name resolution for qualified reference to a view column
  in the HAVING clause.
view.result, view.test:
  Added a test case for bug #13410.
parent 75c43f96
......@@ -2275,3 +2275,16 @@ a
3
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 ( a int, b int );
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;
a
2
3
SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1;
a
2
3
DROP VIEW v1;
DROP TABLE t1;
......@@ -2153,4 +2153,15 @@ SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
DROP VIEW v1;
DROP TABLE t1;
#
# Bug #13410: failed name resolution for qualified view column in HAVING
#
CREATE TABLE t1 ( a int, b int );
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;
DROP VIEW v1;
DROP TABLE t1;
......@@ -2983,7 +2983,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
for (ORDER *cur_group= group_list ; cur_group ; cur_group= cur_group->next)
{
if ((*(cur_group->item))->type() == Item::FIELD_ITEM)
if ((*(cur_group->item))->real_item()->type() == Item::FIELD_ITEM)
{
cur_field= (Item_field*) *cur_group->item;
cur_match_degree= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment