Bug #21010 GROUP BY clause resolves a string as an identifier

Submitted: 12 Jul 2006 17:38 Modified: 12 Jul 2006 20:34
Reporter: Dean Ellis Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0 4.1 5.0 5.1 OS:
Assigned to: CPU Architecture:Any

[12 Jul 2006 17:38] Dean Ellis
Description:
GROUP BY clause mis-resolves a string as an identifier, when that string has the same value as the name of a column or alias in the query.

How to repeat:
CREATE TABLE t1 SELECT 1 a UNION SELECT 2;
SELECT * FROM t1 GROUP BY a;
SELECT * FROM t1 GROUP BY 'a';
SELECT * FROM t1 GROUP BY 'b';

Currently, the first two SELECTs produce identical result sets (two rows each).

Because 'a' is a string and not an identifier, the final two SELECTs should produce identical result sets (one row each).

Suggested fix:
Treat string constants as strings, whether or not they have the same value as an identfier name.
[12 Jul 2006 19:49] Martin Friebe
seems identical to #14019 ?
[12 Jul 2006 20:34] Dean Ellis
Duplicate of bug #14019.  Thanks Martin.

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

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