| Bug #120003 | column name unexpectedly change because of '1' as a column | ||
|---|---|---|---|
| Submitted: | 7 Mar 12:14 | Modified: | 9 Mar 9:40 |
| Reporter: | cl hl | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 8.0.45 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[9 Mar 9:40]
Roy Lyseng
Thank you for the bug report. Verified as described.

Description: the first column's value should be c2, but it's c2_1 because of the second column and the '1' as a column mysql> SELECT DISTINCT subq.c2 AS c2, subq.c2 AS c2_1 FROM (SELECT 1 AS c2 FROM t2 AS s467) AS subq; +------+------+ | c2_1 | c2_1 | +------+------+ | 1 | 1 | +------+------+ 1 row in set (0.00 sec) How to repeat: DROP DATABASE IF EXISTS test; CREATE DATABASE IF NOT EXISTS test; SET GLOBAL sort_buffer_size = 64 * 1024 * 1024; SET GLOBAL read_rnd_buffer_size = 8 * 1024 * 1024; USE test; CREATE TABLE t2 ( c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1) ); INSERT INTO t2 (c1) VALUES (9921); SELECT DISTINCT subq.c2 AS c2, subq.c2 AS c2_1 FROM (SELECT 1 AS c2 FROM t2 AS s467) AS subq;