Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The output alias name is wrong when non-prepared plan cache is enabled #47133

Closed
Mini256 opened this issue Sep 20, 2023 · 2 comments · Fixed by #47417
Closed

The output alias name is wrong when non-prepared plan cache is enabled #47133

Mini256 opened this issue Sep 20, 2023 · 2 comments · Fixed by #47417
Assignees
Labels
affects-7.1 severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@Mini256
Copy link
Member

Mini256 commented Sep 20, 2023

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)

image

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
@Mini256 Mini256 added the type/bug The issue is confirmed as a bug. label Sep 20, 2023
@Mini256
Copy link
Member Author

Mini256 commented Sep 20, 2023

When I tested on playground nightly, it seemed to work properly. Is this a bug that has been fixed?

@winoros
Copy link
Member

winoros commented Sep 20, 2023

image
The problem is related to the non-prepared plan cache. The nightly version will also meet the problem if we turn on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants