[MDEV-22792] vague alias usage in GROUP BY clause Created: 2020-06-04  Updated: 2020-06-04

Status: Open
Project: MariaDB Server
Component/s: Documentation
Affects Version/s: 10.3.23
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Ilya P Assignee: Ian Gilfillan
Resolution: Unresolved Votes: 1
Labels: None
Environment:

5.4.19-200.fc31.x86_64



 Description   

DROP TEMPORARY TABLE IF EXISTS `test_set`;
CREATE TEMPORARY TABLE `test_set`
(
    `id`     INT NOT NULL auto_increment PRIMARY KEY,
    `tag`    VARCHAR(255),
    `tag2`  VARCHAR(255)
);
 
INSERT INTO test_set (tag, tag2)
VALUES ('hello', 'a'),
       ('hello', 'b'),
       ('world', 'c');
 
SELECT COUNT(*), tag2 as tag
FROM test_set
GROUP BY tag;

Not Equal to

SELECT COUNT(*), tag2 as tag3
FROM test_set
GROUP BY tag3;



 Comments   
Comment by Sergei Golubchik [ 2020-06-04 ]

This is intended. But the behavior of aliases column in GROUP BY / ORDER BY / HAVING needs to be documented.

Generated at Thu Feb 08 09:17:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.