pingcap / pingcap/tidb

Implement "drop column with index" through dropping index before dropping column

Open
#40,342 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

For `alter table xxx drop column xxx` statement, it will drop both the column and its index. It brings some problems (e.g. https://github.com/pingcap/tidb/issues/40192). It's also not online-enough in some cases: if a `NOT NULL UNIQUE` column is in write-only mode, the user cannot actually write any data into the table, because the default value of this column is always inserted and checked as duplicated... (though, sounds not like a big problem).

We could try to implement "drop column with index" in multiple steps: drop the index first and then drop the column. It will fix this problem. It'll also make the routine of dropping column more unified with other implementations.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.