#25882: Deletion on ForeignKey raises TypeError
-------------------------------------+-------------------------------------
     Reporter:  gerricom             |                    Owner:  charettes
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  1.9
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:  mysql                |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by charettes):

 Created a [https://github.com/django/django/pull/5826 PR].

 @raphaelmerx thanks for the investigation. I looks like the easiest way to
 reproduce the issue on MySQL is the following.

 {{{#!python
 class A(models.Model):
     text = models.TextField()

 class B(models.Model):
     a = models.ForeignKey(A, models.CASCADE)

 B.objects.delete(a__text='missing')
 }}}

 I suppose the reported test case didn't work because you created a
 `Reader` object. The following should do:

 {{{#!python
 Reader.objects.filter(catalog__name='missing')
 }}}

 In order to trigger the bug you have to generate a delete query that
 issues a join but doesn't match any row on MySQL.

--
Ticket URL: <https://code.djangoproject.com/ticket/25882#comment:10>
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/066.9971c86433210713d056fc87c79af5a4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to