Bug #1031 HAVING clause doesn't accept aliases of derived tables

Submitted: 11 Aug 2003 10:31 Modified: 12 Aug 2003 8:54
Reporter: Alexander Keremidarski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[11 Aug 2003 10:31] Alexander Keremidarski
Description:
Reported in Efnet #mysql

mysql> SELECT a.x FROM (SELECT 1 AS x) AS a;
+---+
| x |
+---+
| 1 |
+---+
1 row in set (0.01 sec)
 
mysql> SELECT a.x FROM (SELECT 1 AS x) AS a HAVING x = 1;
+---+
| x |
+---+
| 1 |
+---+

mysql> SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
ERROR 1054 (42S22): Unknown column 'a.x' in 'having clause'

How to repeat:
select a.x from (select 1 as x) as a having a.x = 1;
[11 Aug 2003 13:53] Oleksandr Byelkin
problem caused by Item_field of select Item list, it have table_name equal to 
"", this value is inherited from field of temporary table created by subquery. 
 
i.e. it is not name resolving problem.
[12 Aug 2003 5:07] Oleksandr Byelkin
ChangeSet 
  1.1612 03/08/12 15:04:49 bell@sanja.is.com.ua +8 -0 
  fixed problem with reference on derived table fields (BUG#1031)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.