Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: closed| Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution: fixed | Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by anonymous): * cc: h...@tbz-pariv.de (removed) -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:22> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: closed| Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution: fixed | Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by libraM): See also http://stackoverflow.com/questions/1006135/how-do-i-create-a-django- model-with-foreignkeys-which-does-not-cascade-deletes-to -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:21> Django <http://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 post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by jacob): The test case is *nasty* -- maybe subclass `UpdateQuery`? -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:18> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by guettli): * cc: h...@tbz-pariv.de (added) -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:17> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by anonymous): * cc: jdu...@gmail.com (added) -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:16> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by bthomas): Replying to [comment:14 liangent]: > i still have the question that why do we need this filter? It was added to fix #7778 -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:15> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by liangent): i still have the question that why do we need this filter? -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:14> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 1 Needs_better_patch: 0 | ---+ Comment (by bthomas): Replying to [comment:9 liangent]: > in the patch, {{{lambda f: f.column == field.rel.get_related_field().name}}}, why can we expect that a field's name can equals to a field's column name? You're right, it should be {{{lambda f: f.column == field.rel.get_related_field().column}}}, of course -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:12> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 1 Needs_better_patch: 0 | ---+ Changes (by Alex): * needs_tests: 0 => 1 -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:11> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by liangent): * cc: liang...@gmail.com (added) Comment: also, i cannot understand why do we need this {{{filter}}} -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:10> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by liangent): in the patch, {{{lambda f: f.column == field.rel.get_related_field().name}}}, why can we expect that a field's name can equals to a field's column name? -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:9> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by bthomas): I'm sorry to hear that, but some more information would be useful. What doesn't work? -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:8> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: 1.1 Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by jacob): * stage: Unreviewed => Accepted * milestone: => 1.1 -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:6> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Unreviewed| Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Comment (by psagers): In case it's not clear, modeltests/delete currently fails under MySQL 5.0.67, not just pyodbc and MSSQL. This is pretty close to a deal-breaker for MySQL support. -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:5> Django <http://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 post to this group, send email to django-updates@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-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Unreviewed| Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by bthomas): * has_patch: 0 => 1 -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:3> Django <http://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 post to this group, send email to django-updates@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-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Unreviewed| Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by anonymous): * cc: [EMAIL PROTECTED] (added) -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:2> Django <http://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 post to this group, send email to django-updates@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-updates?hl=en -~--~~~~--~~--~--~---
Re: [Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record ---+ Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.0 Resolution:| Keywords: delete record foreign key constraint check NULL nullable field Stage: Unreviewed| Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---+ Changes (by bthomas): * needs_better_patch: => 0 * needs_tests: => 0 * needs_docs: => 0 Comment: This is essentially the problem that caused me to re-open ticket #7778. The patch I attached should resolve this. -- Ticket URL: <http://code.djangoproject.com/ticket/9308#comment:1> Django <http://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 post to this group, send email to django-updates@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-updates?hl=en -~--~~~~--~~--~--~---
[Django] #9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record
#9308: Django fails to set nullable foreign key field to NULL before deleting the referenced record + Reporter: egenix_viktor | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM)| Version: 1.0 Keywords: delete record foreign key constraint check NULL nullable field | Stage: Unreviewed Has_patch: 0 | + Unit test: `modeltests/delete` Test case: {{{ # Since E.f is nullable, we should delete F first (after nulling out # the E.f field), then E. >>> o = CollectedObjects() >>> e1._collect_sub_objects(o) >>> o.keys() [, ] >>> e1.delete() }}} It should work as described in the associated comment, since f_id is a nullable column of the delete_e table: {{{ CREATE TABLE [delete_e] ( [id] int IDENTITY (1, 1) NOT NULL PRIMARY KEY, [f_id] int NULL ) }}} Django should set the f_id field in the E record to NULL before trying to delete the F record, but it does not do so. Instead it tries to delete the F record first, which fails the foreign key constraint check associated to the f_id field of the delete_e table (E record). It does not work on databases where deferred constrain checking (checking constraints only COMMIT time) is not an option. For example I found this behavior while running the unit tests through pyodbc (third party, I know) and MSSQL. (Relying on such deferred constraint checking is not a good practice at all.) -- Ticket URL: <http://code.djangoproject.com/ticket/9308> Django <http://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 post to this group, send email to django-updates@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-updates?hl=en -~--~~~~--~~--~--~---