#36388: QuerySet.union no longer supports empty args
--------------------------------+-----------------------------------------
     Reporter:  Antoine Humeau  |                     Type:  Bug
       Status:  new             |                Component:  Uncategorized
      Version:  5.2             |                 Severity:  Normal
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+-----------------------------------------
 Hello there,

 Up until Django 5.1 (included), it was possible to use the union queryset
 method with an empty arg list, example:

 {{{
 User.objects.union()
 }}}

 This example is obviously useless but the following pattern would be
 equivalent and would be more reallistic:


 {{{
 def unite_querysets(querysets):
     queryset, *other_querysets = querysets
     queryset = queryset.union(*other_querysets)
 }}}


 Since Django 5.2, that triggers the following exception:


 {{{
 AttributeError: 'NoneType' object has no attribute 'elide_empty'
 }}}

 The line that triggers the exception is the following:
 
https://github.com/django/django/blob/5.2.1/django/db/models/sql/compiler.py#L616
 empty_compiler is never initialized.


 I am not sure this really qualifies as a bug, it might be a unsupported
 usage, still it is a regression.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36388>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070196c99f888e-a3e1603c-f8b6-44e1-8b37-1203358013aa-000000%40eu-central-1.amazonses.com.

Reply via email to