#30108: Include FK constraints when adding columns in PostgreSQL
-------------------------------------+-------------------------------------
Reporter: Dan Tao | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
FWIW this might have had some unintended side effects on MySQL, we're
still investigating if it's the origin of the issue we're running into.
When combining multiple operations in a single `ALTER STATEMENT` MySQL
will pick a single `ALGORITHM` (the way it performs the operation) that
must be compatible with each operations.
[https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-operations.html
#online-ddl-column-operations In most cases] an `ADD COLUMN` operation can
use the `INSTANT` algorithm while the `ADD CONSTRAINT`
[https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-operations.html
#online-ddl-foreign-key-operations requires the usage of] `INPLACE` or
even `COPY` when foreign key checks are enabled which is the default. From
[https://mariadb.com/kb/en/innodb-online-ddl-operations-with-the-instant-
alter-algorithm/#alter-table-add-foreign-key MariaDB]'s docs (which seem
to be more helpful on the subject) it seems that this is required because
MySQL cannot create indexes `INSTANT`ly.
This means that combining operations now forces the usage of the `COPY`
algorithm for both the column addition and foreign key constraint creation
which we're still trying to determine if it might play a role in making
some of our schema changes more problematic since we upgraded to 3.2 LTS.
--
Ticket URL: <https://code.djangoproject.com/ticket/30108#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701843e5eefb4-d6d5d4a3-3c1a-46c4-862a-4fddf151cfa5-000000%40eu-central-1.amazonses.com.