Bug #8540 Local variable overrides an alias

Submitted: 16 Feb 2005 11:39 Modified: 16 Feb 2005 15:34
Reporter: Alexander Keremidarski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0 OS:Any (any)
Assigned to: Per-Erik Martin CPU Architecture:Any

[16 Feb 2005 11:39] Alexander Keremidarski
Description:
See How To repeat

How to repeat:
CREATE PROCEDURE t()
BEGIN
  DECLARE x INT DEFAULT NULL;
  SET x = 1;
  SELECT x AS y, x+0 AS z;
END

CALL t3()//
+---+------+
| x | z    |
+---+------+
| 1 |    1 |
+---+------+

Note the column names in the result set. 
They should be `y`, `z`  according to the aliases. When the declared value isused alone in SELECT it somehow overrides the alias.

If the SELECT into the procedure contains the 

CREATE PROCEDURE t2() BEGIN DECLARE x INT DEFAULT NULL; SET x = 1; SELECT x+0 AS y; END//

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

Page generated in 0.049 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.