On Thu, Jun 19, 2008 at 9:21 AM, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
> > On Thu, Jun 19, 2008 at 9:04 PM, Peter Melvyn <[EMAIL PROTECTED]> > wrote: > > > > On 6/19/08, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > > >> (2) provide a way to manually disable and re-enable integrity checks. > If > >> someone with more MySQL-fu than me knows how to do either of these > > > > It should work: > > > > SET FOREIGN_KEY_CHECKS = 0; > > Yes - the ticket for this problem (#3615) already has a patch that > uses this technique. > > However, I was under the impression that this has the effect of > disabling, not just deferring key checks - that is, if you disable > checks, load bad data, then re-enable checks, no errors will be > raised. We don't want to be responsible for breaking the referential > integrity of a database, so this isn't a viable solution. > > If I've misunderstood the behaviour of SET FOREIGN_KEY_CHECKS, or you > have any other suggestions, let me know - I'd very much like to put > this bug behind us. > You are correct about how SET FOREIGN_KEY_CHECKS works, there is a note in the doc (http://dev.mysql.com/doc/refman/5.0/en/set-option.html) that mentions this: Setting FOREIGN_KEY_CHECKS to 1 does not trigger a scan of the existing table data. Therefore, rows added to the table while FOREIGN_KEY_CHECKS=0will not be verified for consistency. Here's a tool I found that checks for violated foreign key constraints that may have been introduced while FOREIGN_KEY_CHECKS was set to 0: http://forge.mysql.com/tools/tool.php?id=11 Maybe someone could take a look at that and get some ideas about beefing up the patch for #3615 to include a foreign key check/scan after re-enabling the checking. Karen --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---