[Django] #21257: ForeignKey on_delete functionality should traverse (cascade, ha ha) to the DB backend

4 views
Skip to first unread message

Django

unread,
Oct 11, 2013, 8:42:54 AM10/11/13
to django-...@googlegroups.com
#21257: ForeignKey on_delete functionality should traverse (cascade, ha ha) to the
DB backend
-------------------------------+--------------------
Reporter: gcbirzan | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
By default, django creates FKs without an explicit ON DELETE on the
backend. This, if nothing else, should be configurable. If for no other
reason that when using some transaction isolation modes, the error
returned by the backend will be the wrong one during concurrent
modifications:

Table b links to table a. You insert in table b a link to ID 1 in a, at
the same time as you delete it from a.

With the default (at least in PostgreSQL), in REPEATABLE READ, the error
is IntegrityError, which is wrong, since in fact you should just retry the
transaction. In lower isolation levels, the FK is deleted (as expected),
though, granted the on delete signals are not called.

--
Ticket URL: <https://code.djangoproject.com/ticket/21257>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 14, 2013, 7:07:51 AM10/14/13
to django-...@googlegroups.com
#21257: ForeignKey on_delete functionality should traverse (cascade, ha ha) to the
DB backend
-------------------------------+--------------------------------------

Reporter: gcbirzan | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by mjtamlyn):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

This is likely related to the mailing list conversation
https://docs.djangoproject.com/en/dev/ref/django-admin/#runserver-port-or-
address-port and the ticket #21127. Basically the consensus seems to be
that if we do push to the database it will be a new option to `on_delete`
in the FK declaration. This is also likely to be bundled with the removal
of a default behaviour for `on_delete`.

--
Ticket URL: <https://code.djangoproject.com/ticket/21257#comment:1>

Django

unread,
Oct 14, 2013, 7:08:19 AM10/14/13
to django-...@googlegroups.com
#21257: ForeignKey on_delete functionality should traverse (cascade, ha ha) to the
DB backend
-------------------------------+------------------------------------

Reporter: gcbirzan | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by mjtamlyn):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/21257#comment:2>

Django

unread,
Oct 17, 2013, 6:24:23 AM10/17/13
to django-...@googlegroups.com
#21257: ForeignKey on_delete functionality should traverse (cascade, ha ha) to the
DB backend
-------------------------------+------------------------------------

Reporter: gcbirzan | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by anonymous):

I think the URL should be https://groups.google.com/forum/#!topic/django-
developers/FJMoGgtYIX4

Anyway, it is, but this doesn't involve any default behaviour change, so
it should be way easier.

--
Ticket URL: <https://code.djangoproject.com/ticket/21257#comment:3>

Django

unread,
Apr 10, 2014, 1:24:29 PM4/10/14
to django-...@googlegroups.com
#21257: ForeignKey on_delete functionality should traverse (cascade, ha ha) to the
DB backend
-------------------------------------+-------------------------------------

Reporter: gcbirzan | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* component: Uncategorized => Database layer (models, ORM)


--
Ticket URL: <https://code.djangoproject.com/ticket/21257#comment:4>

Django

unread,
Jul 29, 2015, 9:16:46 AM7/29/15
to django-...@googlegroups.com
#21257: ForeignKey on_delete functionality should traverse (cascade, ha ha) to the
DB backend
-------------------------------------+-------------------------------------
Reporter: gcbirzan | Owner: nobody
Type: New feature | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => duplicate


Comment:

Duplicate of #21961

--
Ticket URL: <https://code.djangoproject.com/ticket/21257#comment:5>

Reply all
Reply to author
Forward
0 new messages