SELECT statement reports "[table:1526]Table has no partition for value from column_list"

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

Original topic: SELECT语句报"[table:1526]Table has no partition for value from column_list"

| username: dba-kit

This error generally indicates that the data to be inserted has a partition key that is not within the existing partition range. Theoretically, if there is no error during insertion, there should not be an error during selection. (The query is a large SQL involving a multi-table join with 3 partitioned tables, and it is still unclear which partitioned table is causing the issue.)

[table:1526]Table has no partition for value from column_list
github.com/pingcap/errors.AddStack
	/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20211224045212-9687c2b0f87c/errors.go:174
github.com/pingcap/errors.(*Error).GenWithStackByArgs
	/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20211224045212-9687c2b0f87c/normalize.go:164
github.com/pingcap/tidb/table/tables.(*partitionedTable).locateRangeColumnPartition
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/table/tables/partition.go:1029
github.com/pingcap/tidb/table/tables.(*partitionedTable).locatePartition
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/table/tables/partition.go:976
github.com/pingcap/tidb/table/tables.(*partitionedTable).GetPartitionByRow
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/table/tables/partition.go:1147
github.com/pingcap/tidb/executor.(*dataReaderBuilder).buildTableReaderForIndexJoin
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/builder.go:4025
github.com/pingcap/tidb/executor.(*dataReaderBuilder).buildExecutorForIndexJoinInternal
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/builder.go:3924
github.com/pingcap/tidb/executor.(*dataReaderBuilder).buildExecutorForIndexJoin
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/builder.go:3917
github.com/pingcap/tidb/executor.(*innerWorker).fetchInnerResults
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/index_lookup_join.go:685
github.com/pingcap/tidb/executor.(*innerWorker).handleTask
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/index_lookup_join.go:524
github.com/pingcap/tidb/executor.(*innerWorker).run
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/index_lookup_join.go:498
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1571
| username: dba-kit | Original post link

I suspect that it is caused by dirty data because there are two pieces of data written into the 9999-12-31 partition in one of the partitioned tables. After communicating with the business team, we backed up and deleted the two pieces of dirty data. It is possible that there are still related data in other tables that have not been cleaned up. I am currently confirming this with the business team. However, theoretically, even if such data exists, it should not cause an error during the select operation.

| username: dba-kit | Original post link

After deleting the associated dirty data, the query still reports the same error. Is it possible to identify which table’s partition has the query issue? Does [table:1526] refer to the table ID? I couldn’t find which table it is in information_schema.tables.

| username: buddyyuan | Original post link

What version are you using? There is a similar issue.

| username: dba-kit | Original post link

It’s 6.1.2. My scenario is different from this one; it’s purely a multi-table join select without adding for update.

| username: dba-kit | Original post link

For partitioned tables, I added a fallback pfuture partition, and the issue was resolved. It seems that the intermediate data during the scan was inconsistent, causing the partition key used when scanning other tables to exceed the limits of the original table (in fact, these data can be directly treated as unmatched since the original table definitely doesn’t have these data). The SQL to add the fallback partition is:

alter table test.t1 ADD PARTITION (PARTITION pfuture VALUES LESS THAN (MAXVALUE));

PS: Since TiDB 6.1 does not yet support the REORGANIZE PARTITION operation, to enable periodic partition creation, only the partition for the next year was created, and the fallback pfuture partition was not created.

| username: Lucien-卢西恩 | Original post link

Hello, after adding the pfuture partition, did the error get bypassed? Could you provide the reproduction steps so we can try to reproduce it and see if it can be fixed in the future?

| username: system | Original post link

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