Disable foreign key checks when preparing existing schema for preflight schema change tests#4696
Merged
morgo merged 1 commit intovitessio:masterfrom May 27, 2020
Merged
Conversation
Collaborator
Author
|
It's probably best not to merge this in it's current state: ideally it would respect the existing foreign_key_checks value rather than assuming it was on, in case someone wants to apply a schema change with foreign key checks already off globally. |
Collaborator
Author
|
Changed, but not yet tested |
03bc644 to
e5d8794
Compare
0f4b570 to
71dd981
Compare
3 tasks
Collaborator
Author
|
I removed unnecessarily cleverness from earlier versions of this PR, so it should be equivalent to the version we use in the Pinterest codebase. Since the foreign_key_checks variable is session-scoped the new DDL runs in a new session it still be subject to foreign key checks if they're enabled. |
Contributor
|
@dweitzman this PR still makes sense to me. Can you rebase on master, and lets try and merge it? |
The preflight schema check copies the entire existing schema into a temporary database and then tests the user-provided DDL. During that copy we need to disable foreign key checks because we're not yet clever enough to copy the tables in an order that's compatible with foreign key checks being on. Foreign key checks are still applicable to the user-provided DDL Signed-off-by: David Weitzman <dweitzman@pinterest.com>
Collaborator
Author
|
Rebased |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The preflight check isn't clever enough to create the existing schema in a foreign-key-friendly order, so we temporarily disable foreign key checks while creating the existing tables.