Hi Russell and Jim, On 07/06/2011 05:34 PM, Russell Keith-Magee wrote: > On Thu, Jul 7, 2011 at 5:05 AM, Jim D. <jim.dal...@gmail.com> wrote: >> * There's a DB feature can_defer_constraint_checks . I couldn't find much >> by way of documentation or or usage of this feature. But I was trying to >> figure out if the work we are doing here is what this feature refers to, and >> if so, if we should be marking this as True for MySQL and SQLite with this >> implementation. I'm not sure there is other behavior that is required or >> expected in that attribute. Anyhow, that might also be a path forward for >> the issue I raise above (ie. we could skip the test if >> can_defer_constraint_checks is not True). > > This feature flag exists essentially to verify whether MySQL InnoDB is > currently in use. It isn't used during normal runtime; it's purely a > test skipping flag. It's used to identify tests that need to be > skipped because the test data requires a circular reference which > (historically) hasn't been possible under InnoDB because constraints > aren't checked. > > Essentially, this feature flag shouldn't need to exist at all; it only > exists so that InnoDB passes the test suite without errors. If we are > able to resolve the issue that allows MySQL to use forward references > in data, then this feature flag shouldn't be required at all.
This isn't true since the introduction of the new deletion code last fall. The feature flag is used in db/models/deletion.py to detect whether it is necessary to null out nullable FKs prior to deletion. On backends which can defer constraints, this nulling-out would add a needless extra query. On backends which can't defer, nulling-out means the nullable FK relationship doesn't dictate a deletion-ordering constraint, which lets us handle circular FK references as long as at least one of them is nullable (otherwise we'd have to just throw up our hands and hope for the best, likely resulting in an integrity error). Since this use of the flag is unrelated to fixture loading, the fixture-loading fix should not change the value of the flag for any backend. Carl -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.