Select Single Table Error SQL Error [1105] [HY000]: runtime error: index out of range [0] with length 0

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: select 单表报错 SQL 错误 [1105] [HY000]: runtime error: index out of range [0] with length 0

| username: TiDBer_Xin

Bug Report
Clearly and accurately describe the issue you found. Providing any possible steps to reproduce the issue will help the development team address it promptly.
【TiDB Version】7.1.1
【Impact of the Bug】Query not returning results

【Possible Steps to Reproduce the Issue】
select * from AuthorReputation
【Observed Unexpected Behavior】
image

【Expected Behavior】
Query should succeed
【Related Components and Specific Versions】

【Other Background Information or Screenshots】
Execution Plan:


Partition:
image

| username: tidb菜鸟一只 | Original post link

Is it only this table that is reporting an error? Can you share the table structure for us to take a look?

| username: TiDBer_Xin | Original post link

Yes, that’s it.

| username: Billmay表妹 | Original post link

The reported issue is the same as this one: 7.1.1 集群执行sql ERROR 1105 (HY000): runtime error: index out of range [0] with length 0 - TiDB 的问答社区

Currently investigating the problem.

| username: aytrack | Original post link

It’s a bug, this issue is being tracked here: query partition table with limit report runtime error: index out of range [0] with length 0 · Issue #45804 · pingcap/tidb · GitHub

| username: aytrack | Original post link

You can add an order by before limit to work around this issue.

| username: TiDBer_Xin | Original post link

It doesn’t work, and even without adding a limit, directly selecting * from the table also doesn’t work.

| username: TiDBer_Xin | Original post link

Moreover, why do my other partitioned tables work? They are also hash partitioned. Why is it just this table that doesn’t work?

| username: aytrack | Original post link

Take a look at the query plans for other partitioned tables to see if they are using static mode, while the table with the error is using dynamic mode.

| username: redgame | Original post link

Isn’t this a classic case of index out of range?

| username: 像风一样的男子 | Original post link

Try changing “select *” to “select [column names]”.

| username: tidb菜鸟一只 | Original post link

Set tidb_partition_prune_mode=‘static’;
Try setting the partition table to not use dynamic pruning.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.