#25492: Check deferred foreign key constraints before dropping them
--------------------------------------+------------------------------------
Reporter: Joey Wilhelm | Owner: nobody
Type: New feature | Status: new
Component: Core (System checks) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Simon Charette):
* stage: Ready for checkin => Accepted
Comment:
I adjusted the patch to perform `SET CONSTRAINT %(name)s IMMEDIATE` before
dropping a constraint only on PostgreSQL as it's the only backend that
supports both deferrable foreign keys and transactional DDL which are the
two conditions required for this issue to arise.
I used feature detection with `skipUnlessDbFeature` to make sure the test
will be run on SQLite If we were to make foreign keys `DEFERRABLE
INITIALLY DEFERRED`
[https://code.djangoproject.com/ticket/14204#comment:19 like they are on
PostgreSQL and Oracle].
@shai
> Haven't got time to review the patch, just wanted to note that mixing
schema-altering operations with data-modifying operations can have other
issues, mostly related to deferred SQL
Don't worry, this patch isn't about encouraging both types of alteration
to be performed in the same migration which is another can of worm. It's
focusing on making sure we perform the pending checks on foreign key
constraints before dropping them.
--
Ticket URL: <https://code.djangoproject.com/ticket/25492#comment:12>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.1edb53fe11d8afb4913849861dabadef%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.