Bug #13411 HAVING clause filtering on unqualified view column name crashes server
Submitted: 22 Sep 2005 20:29 Modified: 30 Sep 2005 17:12
Reporter: Dean Ellis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Views Severity:S1 (Critical)
Version:5.0.14 OS:
Assigned to: Igor Babaev CPU Architecture:Any

[22 Sep 2005 20:29] Dean Ellis
Description:
A HAVING clause referencing an unqualified view column name crashes the server.

How to repeat:
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
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 a IN (1,2,3);
SELECT v1.a FROM v1 GROUP BY v1.a HAVING a IN (1,2,3);

Suggested fix:
n/a
[27 Sep 2005 3:19] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30360
[28 Sep 2005 1:26] Igor Babaev
ChangeSet
  1.1996 05/09/26 20:18:59 igor@rurik.mysql.com +4 -0
  sql_base.cc, item.cc:
    Fixed bug #13411.
    Fixed name resolution for non-qualified reference to a view column
    in the HAVING clause.
  view.result, view.test:
    Added a test case for bug #13411.

The fix will appear in 5.0.14
[30 Sep 2005 17:12] Paul DuBois
Noted in 5.0.14 changelog.