Skip to content

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

Closed

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

Activity

  1. 3 remaining items

  2. added a commit that references this issue on Apr 25, 2025
    c489679
  3. bb7133 commented on Apr 25, 2025

    @bb7133
    Member

    I checked all the test plans before we made EXCHANGE PARTITION GA...unfortunately clustered/non-clustered indexes are missing.

    @mjonss @Defined2014 Do you think this should be a major or critical bug?

  4. added
    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.
    on Apr 25, 2025
  5. bb7133 commented on Apr 25, 2025

    @bb7133
    Member

    I'll set it to 'critical' due to the corrupted data.

  6. added a commit that references this issue on Apr 27, 2025
    0096bd5
  7. added a commit that references this issue on Apr 29, 2025
    7d62973
  8. added a commit that references this issue on Jul 9, 2025
    b48a8c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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