On 1/19/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > I've been looking at the code for normal object deletion in an attempt > to get the same behaviour for bulk delete. It seems like there is a > lot of logic dedicated to maintaining referential integrity that the > database could be doing (and would probably do more efficiently). > > Is there any particular reason that Django has its own implementation > of referential integrity rather than using the referential integrity > capabilities of SQL?
The database would no doubt be more efficient, but SQLite and MySQL (some versions) don't support referential integrity. We opted to do it at the code level. > It seems like most of the internal reference walking logic in the > object.delete() call would be eliminated if the foreign key fields > were declared ON DELETE CASCADE or ON DELETE SET NULL (as > appropriate). This is exactly what Django used to do, actually, back when it was Postgres-only. Such are the compromises of having to support other DBs. :-/ Adrian -- Adrian Holovaty holovaty.com | djangoproject.com | chicagocrime.org
