We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please answer these questions before submitting your issue. Thanks!
In a session without plancache
set @@tidb_enable_prepared_plan_cache=0; set @@time_zone='UTC'; set @@collation_connection='utf8_general_ci'; prepare s from 'select DATE_FORMAT("2020-01-01","%W") = "wednesday"'; execute s; -- output 1 set @@collation_connection='utf8_bin'; execute s; -- output 0
In a session with plancache
set @@tidb_enable_prepared_plan_cache=1; set @@time_zone='UTC'; set @@collation_connection='utf8_general_ci'; prepare s from 'select DATE_FORMAT("2020-01-01","%W") = "wednesday"'; execute s; -- output 1 set @@collation_connection='utf8_bin'; execute s; -- output 1
The second execute should output a same value not matter tidb_enable_prepared_plan_cache is on or off
tidb_enable_prepared_plan_cache
The output of the second execute is not the same for different tidb_enable_prepared_plan_cache value
master
The text was updated successfully, but these errors were encountered:
I think the reason is the expression is computing it's collation using session collation here:
tidb/expression/collation.go
Line 242 in 533de3b
But when the collation of session changes, the cached plan still uses the old value.
Sorry, something went wrong.
It seems like we should consider connection's charset when hitting the plan cache:
I'll fix it this week.
planner: consider connection collation when reusing cached plans (#47072
ca57ed1
) close #47008
qw4990
Successfully merging a pull request may close this issue.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
In a session without plancache
In a session with plancache
2. What did you expect to see? (Required)
The second execute should output a same value not matter
tidb_enable_prepared_plan_cache
is on or off3. What did you see instead (Required)
The output of the second execute is not the same for different
tidb_enable_prepared_plan_cache
value4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered: