Django

Code

Ticket #2549 (closed: duplicate)

Opened 2 years ago

Last modified 10 months ago

django.db.models.fill_table_cache will dead loop if with circular Foreign Keys

Reported by: anonymous Assigned to: nobody
Milestone: Component: Database wrapper
Version: SVN Keywords: loop db fill_table_cache foreign key, qs-rf
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

This function might fall into dead loop if there's a loop in the Foreign Key Relationships.

Attachments

Change History

08/16/06 08:37:20 changed by anonymous

  • summary changed from django.db.models.fill_table_cache to django.db.models.fill_table_cache might dead loop.

10/17/06 00:04:20 changed by anonymous

  • keywords set to loop db fill_table_cache foreign key.

I find this happens to me (without fail) using this very simple Model:

from django.db import models

class A(models.Model):
    B = models.ForeignKey('B')
    class Admin:
        list_display = ('B',)

class B(models.Model):
    A = models.ForeignKey('A')
    class Admin:
        pass

Clicking on "A" in the Admins Interface loops forever. Clicking on "B" works just fine. I don't know a lot about the internals but I get the feeling that the Admin interface is not the problem, but that "fill_table_cache" is. I would consider changing this to a "Blocker" as this is not that uncommon. If anyone knows where I can find more information on this, please attach it to this ticket.

10/17/06 16:20:46 changed by anonymous

  • summary changed from django.db.models.fill_table_cache might dead loop to django.db.models.fill_table_cache will dead loop if with circular Foreign Keys.

Ouch! My model was more like A->B, B->C, C->A. Same result.

11/26/06 19:18:31 changed by adrian

  • owner changed from jacob to adrian.
  • component changed from Cache system to Database wrapper.

12/15/06 20:44:28 changed by anonymous

I've opened this 4 month ago, but it's still open!

So I decided I will solve it myself!! I'll use this weekend to make a patch. I've made one 4 month ago but I can't find it now.

01/05/07 20:24:45 changed by anonymous

Hey Mr. Anon -

Waiting for that patch :)

01/17/07 16:12:17 changed by

  • milestone deleted.

Milestone Version 1.0 deleted

09/13/07 16:36:40 changed by mtredinnick

  • keywords changed from loop db fill_table_cache foreign key to loop db fill_table_cache foreign key, qs-rf.

09/16/07 11:05:33 changed by PhiR

  • status changed from new to closed.
  • resolution set to duplicate.

#3288 is a specific case of this but has a patch fixing this issue for both SVN and 0.96. Adding regression tests too.


Add/Change #2549 (django.db.models.fill_table_cache will dead loop if with circular Foreign Keys)




Change Properties
Action