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

UCP: Support the operation of adding multi-columns #5092

Closed
zimulala opened this issue Nov 14, 2017 · 9 comments · Fixed by #15540
Closed

UCP: Support the operation of adding multi-columns #5092

zimulala opened this issue Nov 14, 2017 · 9 comments · Fixed by #15540
Labels
feature/accepted This feature request is accepted by product managers help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@zimulala
Copy link
Contributor

zimulala commented Nov 14, 2017

Description

Support adding multi-columns in one statement, the syntax as follows:

ALTER TABLE tbl_name
    [alter_specification [, alter_specification] ...]

alter_specification:
ADD [COLUMN] (col_name column_definition,...)

We can add a new action as AddColumns to handle this DDL job. We can achieve this by referring to AddColumn action.

#3627 implementation was basically okay for the current version, if you need it, you can also use it as a reference.

Score

  • 2996

Mentor(s)

Contact the mentors: #tidb-challenge-program channel in TiDB Community Slack Workspace

Recommended Skills

  • SQL executor
  • TiDB DDL
  • Golang

Learning Materials

MySQL's document for syntax reference.
TiDB DDL architecture

@shenli
Copy link
Member

shenli commented Nov 14, 2017

@breeswish PTAL

@zimulala zimulala added the DDL label Nov 14, 2017
@breezewish
Copy link
Member

related: #3627

@morgo
Copy link
Contributor

morgo commented Dec 10, 2018

@zimulala can we close this issue now? I assume it is in reference to composite indexes (which are supported), and not chaining multiple ddl changes at once (roadmap).

@zimulala
Copy link
Contributor Author

@morgo I can't close this issue yet. We support composite indexes. But this issue says that it supports adding multiple columns in a statement, for example:

alter table tbl add column (c4 int default 1, c5 int);

@zimulala
Copy link
Contributor Author

Related to issues:

@zimulala zimulala added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. difficulty/hard type/new-feature labels Feb 28, 2020
@zz-jason zz-jason changed the title Support the operation of adding multi-columns UCP: Support the operation of adding multi-columns Feb 28, 2020
@zimulala zimulala added sig/sql-infra SIG: SQL Infra and removed component/DDL1 labels Mar 4, 2020
@gauss1314
Copy link
Contributor

/pick-up-challenge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 17, 2020

@gauss1314 pick up issue success

@gauss1314
Copy link
Contributor

Hi, @zimulala , I think there are 3 kinds of add multi-columns:

  1. alter table t add column (b int, c int);
  2. alter table t add column b int after a, add column c int after b;
  3. alter table t add column (b int, c int), add column d int after b;

This issue only mentioned first one, and I think the lack of the latter two affects usability.
But implementing all three maybe a bit difficult. So what's your suggestion?

@zimulala
Copy link
Contributor Author

These are just the different positions of the columns. We can adjust their position uniformly at the end of processing. The special function is adjustColumnInfoInAddColumn.
This issue itself may be more complicated. If you think it is necessary, we can implement the first type of statement first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants