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

ddl, planner: support ALTER TABLE without use db (#18784) #19471

Merged
merged 2 commits into from
Sep 2, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #18784 to release-4.0


What problem does this PR solve?

Issue Number: close #18756

Problem Summary: alter table db.t1 add constraint fk foreign key (c2) references t2(c1) without first executing use db, TiDB will report No database selected. That is because c2 has no schema(dbName), nor do we have a global CurrentDB. But mysql will try to use dbName from db.t1. Manually tested.

Check List

Tests

  • Unit test
  • Integration test

Release note

  • allow alter table db.t1 add constraint fk foreign key (c2) references t2(c1) like statements without first executing use db

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added contribution This PR is from a community contributor. sig/sql-infra SIG: SQL Infra type/4.0-cherry-pick labels Aug 26, 2020
@ti-srebot ti-srebot added this to the v4.0.6 milestone Aug 26, 2020
@ti-srebot ti-srebot self-assigned this Aug 26, 2020
Copy link
Contributor

@djshow832 djshow832 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 26, 2020
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 26, 2020
@zz-jason
Copy link
Member

zz-jason commented Sep 2, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 2, 2020
@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 19457

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@zz-jason zz-jason merged commit 54840da into pingcap:release-4.0 Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants