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

Index out of range when querying on partitioned tables within a transaction #20028

Closed
zyguan opened this issue Sep 16, 2020 · 4 comments · Fixed by #21148
Closed

Index out of range when querying on partitioned tables within a transaction #20028

zyguan opened this issue Sep 16, 2020 · 4 comments · Fixed by #21148
Assignees
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@zyguan
Copy link
Contributor

zyguan commented Sep 16, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1, t2;
-- init
create table t1 (c_datetime datetime, primary key (c_datetime)) partition by range (to_days(c_datetime)) ( partition p0 values less than (to_days('2020-02-01')), partition p1 values less than (to_days('2020-04-01')), partition p2 values less than (to_days('2020-06-01')), partition p3 values less than maxvalue) ;
create table t2 (c_datetime datetime, unique key(c_datetime));
insert into t1 values ('2020-06-26 03:24:00'), ('2020-02-21 07:15:33'), ('2020-04-27 13:50:58');
insert into t2 values ('2020-01-10 09:36:00'), ('2020-02-04 06:00:00'), ('2020-06-12 03:45:18');
-- txn
begin;
select * from t1 join t2 on t1.c_datetime >= t2.c_datetime for update; -- ERROR 1105 (HY000): runtime error: index out of range
rollback;

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

No error reported.

3. What did you see instead (Required)

mysql> begin;
Query OK, 0 rows affected (0.05 sec)

mysql> select * from t1 join t2 on t1.c_datetime >= t2.c_datetime for update;
ERROR 1105 (HY000): runtime error: index out of range [2] with length 2

4. What is your TiDB version? (Required)

master @ fa6baa9
release-4.0 @ 51d365f

@zyguan zyguan added the type/bug The issue is confirmed as a bug. label Sep 16, 2020
@ZenoTan
Copy link

ZenoTan commented Sep 16, 2020

/label sig/ddl

@ti-srebot ti-srebot added the sig/sql-infra SIG: SQL Infra label Sep 16, 2020
@ichn-hu
Copy link
Contributor

ichn-hu commented Sep 17, 2020

/assign @ichn-hu

@ichn-hu
Copy link
Contributor

ichn-hu commented Nov 12, 2020

/unassign @ichn-hu

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants