-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.severity/moderatesig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
DDL:
CREATE TABLE `user` (
`id` int NOT NULL,
`personId` int NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`, `personId`)
) ENGINE=InnoDB;
The first execution returns the column name specified in the SQL statement.
When I execute the same SQL statement again, the alias in the SQL statement will be ignored in the subsequent return results.
TiDB [email protected]:case5> SELECT `User`.`id` AS `User_id`, `User`.`personId` AS `User_personId`, `User`.`name` AS `User_name` FROM `user` `User` WHERE (((`User`.`id` = 1 AND `User`.`personId` = 1)))
+---------+---------------+-----------+
| User_id | User_personId | User_name |
+---------+---------------+-----------+
+---------+---------------+-----------+
0 rows in set
Time: 0.007s
TiDB [email protected]:case5> SELECT `User`.`id` AS `User_id`, `User`.`personId` AS `User_personId`, `User`.`name` AS `User_name` FROM `user` `User` WHERE (((`User`.`id` = 1 AND `User`.`personId` = 1)))
+----+----------+------+
| id | personId | name |
+----+----------+------+
+----+----------+------+
0 rows in set
Time: 0.006s
2. What did you expect to see? (Required)
Query returns the specified alias based on SQL.
3. What did you see instead (Required)

4. What is your TiDB version? (Required)
tidb_version() | Release Version: v7.3.0
Edition: Community
Git Commit Hash: 40b72e7a9a4fc9670d4c5d974dd503a3c6097471
Git Branch: heads/refs/tags/v7.3.0
UTC Build Time: 2023-08-08 09:27:28
GoVersion: go1.20.7
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Metadata
Metadata
Assignees
Labels
affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.severity/moderatesig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.