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

planner: support foreign key choose parent schema as default in CreateTable stmt (#12548) #12675

Merged
merged 3 commits into from
Oct 18, 2019

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Oct 14, 2019

cherry-pick #12548 to release-3.0


What problem does this PR solve?

Aligned with MySQL behavior

drop database if exists fk_test;
create database if not exists fk_test;
create table fk_test.t1 (c1 int not null primary key);
create table fk_test.t2 (id int not null primary key, c1 int not null, constraint foreign key (c1) references t1(c1));

MySQL can deal with above sql well, but TiDB will get ERROR 1046 (3D000) at line 4: No database selected

What is changed and how it works?

if foreign key has no schema, use parent table schema

Check List

Tests

  • Unit test

Code changes

  • NA

Side effects

  • NA

Related changes

  • Need to cherry-pick to the release branch

Release note

  • Fix a compatibility issue that if the foreign key constraint in CREATE TABLE statement has no schema, schema of the created table should be used instead of returning No Database selected error.

@sre-bot
Copy link
Contributor Author

sre-bot commented Oct 14, 2019

/run-all-tests

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@bb7133 bb7133 added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 14, 2019
Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

LGTM

@bb7133 bb7133 added status/LGT2 Indicates that a PR has LGTM 2. status/all tests passed and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 15, 2019
@ngaut ngaut added the status/can-merge Indicates a PR has been approved by a committer. label Oct 15, 2019
@ngaut ngaut removed the status/PTAL label Oct 15, 2019
@sre-bot
Copy link
Contributor Author

sre-bot commented Oct 15, 2019

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Oct 15, 2019

@sre-bot merge failed.

@zz-jason
Copy link
Member

/run-integration-common-test

@zz-jason zz-jason removed the request for review from eurekaka October 16, 2019 01:02
@sre-bot
Copy link
Contributor Author

sre-bot commented Oct 16, 2019

@bb7133, @crazycs520, PTAL.

2 similar comments
@sre-bot
Copy link
Contributor Author

sre-bot commented Oct 18, 2019

@bb7133, @crazycs520, PTAL.

@sre-bot
Copy link
Contributor Author

sre-bot commented Oct 18, 2019

@bb7133, @crazycs520, PTAL.

@zz-jason
Copy link
Member

LGTM

@zz-jason
Copy link
Member

/merge

@sre-bot
Copy link
Contributor Author

sre-bot commented Oct 18, 2019

/run-all-tests

Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added the priority/release-blocker This issue blocks a release. Please solve it ASAP. label Oct 18, 2019
@sre-bot sre-bot merged commit 67d8fbf into pingcap:release-3.0 Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/release-blocker This issue blocks a release. Please solve it ASAP. sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants