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.