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

'current_date' cause wrong result when using plan-cache #45086

Closed
King-Dylan opened this issue Jun 30, 2023 · 2 comments · Fixed by #45119
Closed

'current_date' cause wrong result when using plan-cache #45086

King-Dylan opened this issue Jun 30, 2023 · 2 comments · Fixed by #45119
Assignees
Labels

Comments

@King-Dylan
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t` (
  `a` int(11) DEFAULT NULL,
  `b` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin

insert into t values('1','2023-06-30');
set tidb_enable_non_prepared_plan_cache=on;
select * from t where b=current_date();

2. What did you expect to see? (Required)

+------+------------+
| a    | b          |
+------+------------+
|    1 | 2023-06-30 |
+------+------------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

Empty set (0.00 sec)

4. What is your TiDB version? (Required)

v7.1.0

@King-Dylan King-Dylan added the type/bug This issue is a bug. label Jun 30, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Jul 3, 2023
@qw4990
Copy link
Contributor

qw4990 commented Jul 3, 2023

Prepared statements have the same problem:

prepare st from 'select * from t where b=current_date();';
execute st;

@qw4990 qw4990 changed the title Wrong result when enable tidb_enable_non_prepared_plan_cache Wrong result when using current_date Jul 3, 2023
@qw4990 qw4990 changed the title Wrong result when using current_date 'current_date' cause wrong result when using plan-cache Jul 3, 2023
@qw4990
Copy link
Contributor

qw4990 commented Jul 3, 2023

I'll fix this today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants