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

Require same constraints on tables for EXCHANGE PARTITION #56754

Open
mjonss opened this issue Oct 21, 2024 · 1 comment
Open

Require same constraints on tables for EXCHANGE PARTITION #56754

mjonss opened this issue Oct 21, 2024 · 1 comment
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@mjonss
Copy link
Contributor

mjonss commented Oct 21, 2024

Enhancement

Currently EXCHANGE PARTITION allows for different CONSTRAINTS on the partitioned table and the non-partitioned table and having some extra code to check constraints during the DDL.

It would be easier if we only allowed EXCHANGE PARTITION to work with tables that have the same CONSTRAINTS, just like it needs to have the same columns, indexes and other table attributes.

@mjonss mjonss added the type/enhancement The issue or PR belongs to an enhancement. label Oct 21, 2024
@mjonss
Copy link
Contributor Author

mjonss commented Oct 21, 2024

Also the error is wrong if there is a row that breaks the constraint on the non-partitioned table:

tidb> alter table t exchange partition p1 with table t2;
ERROR 1737 (HY000): Found a row that does not match the partition

In tidb_version():

tidb_version(): Release Version: v8.4.0-alpha-440-gd5b27a91ce
Edition: Community
Git Commit Hash: d5b27a91ce5f9ff16d79a8fe2c2b798b5cb104b6
Git Branch: HEAD
UTC Build Time: 2024-10-21 10:35:41
GoVersion: go1.23.2
Race Enabled: false
Check Table Before Drop: false
Store: tikv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant