-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: automatically add index for fk constraint on empty table
Adding a foreign key constraint requires that the referencing column(s) be indexed, so previously, an ALTER TABLE statement to add a foreign key constraint for an existing table would always fail, even if the referencing table were empty. This change automatically adds the needed index for the foreign key constraint when the table is empty. This will improve compatibility with some ORMs, which create tables before adding foreign key constraints. Fixes #26738 Release note (sql change): An ALTER TABLE statement to add a foreign key constraint now automatically creates the necessary index if the referencing table is empty, if the index does not already exist.
- Loading branch information
1 parent
3b256be
commit d67ac45
Showing
7 changed files
with
338 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.