-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Labels
epic/plan-cachereport/customerCustomers have encountered this bug.Customers have encountered this bug.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)
MySQL 8.4.4
create table t1(id bigint primary key, name varchar(100));
prepare stmt from 'select name, ? from t1 group by name, ?';
set @a="0", @b="0";
execute stmt using @a, @b;
TiDB 8.5.2
create table t1(id bigint primary key nonclustered, name varchar(100));
prepare stmt from 'select name, ? from t1 group by name, ?';
show warnings;
set @a="0", @b="0";
execute stmt using @a, @b;
2. What did you expect to see? (Required)
The query should behave the same as in MySQL 8.4.4:
No error should be reported, and the statement should execute successfully, returning an empty set.
3. What did you see instead (Required)
In TiDB 8.5.2, when executing execute stmt using @a, @b;
, the following error occurs:
ERROR 1105 (HY000): Unknown column '0' in 'group statement'
And when preparing the statement, a warning is shown:
Warning | 1105 | skip prepared plan-cache: query has 'group by ?' is un-cacheable
4. What is your TiDB version? (Required)
select tidb_version();
Example output:
Release Version: v8.5.2
Edition: Community
Compatibility Conclusion
This SQL works fine in MySQL 8.4.4, but fails in TiDB 8.5.2.
It seems to be a compatibility issue regarding parameter placeholders in theGROUP BY
clause.
Metadata
Metadata
Assignees
Labels
epic/plan-cachereport/customerCustomers have encountered this bug.Customers have encountered this bug.severity/moderatesig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.