On Sun, Sep 19, 2010 at 11:41 AM, Alex Gaynor <alex.gay...@gmail.com> wrote:

> On Sun, Sep 19, 2010 at 10:28 AM, drakkan <drakkan1...@gmail.com> wrote:
> > in my opinion django should emulate "ON DELETE CASCADE" only on
> > database backends that doesn't support it, if you are using a database
> > such as postgres delete() on a queryset should issue a single sql
> > query and should be the database to care about the cascade/set null
> > etc.. behaviour
> >
> > http://code.djangoproject.com/ticket/7539
> >
> > I think this way django could archive the best performance,
> >
> > if one need to delete a lot of row and there are relations to other
> > tables a single raw SQL query is not enough, you need to modify the
> > database schema too to ensure the correct cascade behaviuor or you
> > need to issue an sql query for every related table
>
>
> We also support cascading generic relationships, which no database
> supports.
>

And currently the pre- and post-delete signals are called for each object,
even in a bulk delete, so changing that would be a backwards-incompatible
change.  I don't much like that it does this, but changing it would still
undoubtedly cause trouble for some people.

That said, queryset.update() does NOT iterate through all the objects in a
queryset and call save(), and nor does it call the pre- and post-save
signals. [1]

We have two bulk operations that behave differently; would it be worthwhile,
at least, to make the behavior configurable?

Tobias

[1]
http://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once
-- 
Tobias McNulty, Managing Partner
Caktus Consulting Group, LLC
http://www.caktusgroup.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to