#9961: select_related(depth=0) should be a no-op ------------------------------------------+--------------------------------- Reporter: rdaysky | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.0 Keywords: | Stage: Unreviewed Has_patch: 1 | ------------------------------------------+--------------------------------- The documentation does not define any behavior for queryset.select_related(depth=0). The implementation treats that as if the depth parameter were not set at all, selecting all related objects.
I propose having queryset.select_related(depth=0) return the same queryset, unaltered. That does not break documented behavior because it is not documented in the first place. The reason is uniformity. Suppose I want to test how select_related affects performance. I add a constant and add select_related(depth=SELECT_RELATED_DEPTH) in several places. I want to benchmark the application with different values, but the existing implementation of select_related does not allow me to set a value that would disable select_related altogether. The patch is very simple, attaching. -- Ticket URL: <http://code.djangoproject.com/ticket/9961> 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---
