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

query key Partition table get panic while Partition Key is not first column #50698

Closed
aytrack opened this issue Jan 24, 2024 · 4 comments
Closed
Labels
affects-7.5 component/tablepartition This issue is related to Table Partition of TiDB. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 report/community The community has encountered this bug. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. type/regression

Comments

@aytrack
Copy link
Contributor

aytrack commented Jan 24, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1;
create table t1(a int, id bigint primary key, name varchar(20)) partition by key(id) partitions 4;
select * from t1 where id = 'a';

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

query success

3. What did you see instead (Required)

get panic

[16:46:38]TiDB root:test>  select * from t1 where id = 'a';
(1105, 'runtime error: index out of range [1] with length 1')
[16:46:38]TiDB root:test>

4. What is your TiDB version? (Required)

all tidb versions

[16:47:07]TiDB root:test> select tidb_version();
+-----------------------------------------------------------+
| tidb_version()                                            |
+-----------------------------------------------------------+
| Release Version: v7.6.0                                   |
| Edition: Community                                        |
| Git Commit Hash: 6701bf1527c7386a82396a1ecfb5322872daa2b3 |
| Git Branch: heads/refs/tags/v7.6.0                        |
| UTC Build Time: 2024-01-08 12:51:43                       |
| GoVersion: go1.21.5                                       |
| Race Enabled: false                                       |
| Check Table Before Drop: false                            |
| Store: unistore                                           |
+-----------------------------------------------------------+
@aytrack aytrack added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/major component/tablepartition This issue is related to Table Partition of TiDB. labels Jan 24, 2024
@aytrack aytrack changed the title query key Partition table get panic while PK is not first column query key Partition table get panic while Partition Key is not first column Jan 24, 2024
@kennedy8312
Copy link

/type regression

@kennedy8312
Copy link

The same operation didn't trigger the error on v6.5.0.
mysql> use test;
Database changed
mysql> drop table if exists t1;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table t1(a int, id bigint primary key, name varchar(20)) partition by key(id) partitions 4;
Query OK, 0 rows affected, 1 warning (0.10 sec)

mysql> select * from t1 where id = 'a';
Empty set, 2 warnings (0.01 sec)

mysql> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.5.0
Edition: Community
Git Commit Hash: 706c3fa
Git Branch: heads/refs/tags/v6.5.0
UTC Build Time: 2022-12-27 03:42:38
GoVersion: go1.19.3
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

@Defined2014
Copy link
Contributor

dup with #50206

@Defined2014 Defined2014 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2024
@bb7133 bb7133 reopened this Jan 30, 2024
@bb7133 bb7133 closed this as completed Jan 30, 2024
@Defined2014 Defined2014 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
@seiya-annie
Copy link

/found community

@ti-chi-bot ti-chi-bot bot added the report/community The community has encountered this bug. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.5 component/tablepartition This issue is related to Table Partition of TiDB. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 report/community The community has encountered this bug. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. type/regression
Projects
None yet
Development

No branches or pull requests

6 participants