Skip to content

alter table ... exchange partition ... does not forbid operations between clustered and nonclustered table #60805

@lcwangchao

Description

@lcwangchao

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

> create table ta (pk int not null, ex int not null, primary key (pk, ex) nonclustered) partition by range(pk) (PARTITION p1 values less than (10));
> create table tb (pk int not null, ex int not null, primary key (pk, ex) clustered);
> insert into ta values(1, 2);
> alter table ta exchange partition p1 with table tb;
> admin check table ta;

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

We should reject exchange partition when two tables have the different pk types (nonclustered vs clustered).

3. What did you see instead (Required)

> alter table ta exchange partition p1 with table tb; --- successed
Query OK, 0 rows affected
Time: 0.058s
> admin check table ta; -- but data corrupted
(1105, '[components/tidb_query_executors/src/table_scan_executor.rs:425]: Data is corrupted, missing data for NOT NULL column (offset = 0)')

4. What is your TiDB version? (Required)

master, But I think it affect all versions

Metadata

Metadata

Assignees

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.severity/criticalsig/sql-infraSIG: SQL Infratype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions