﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36388	QuerySet.union no longer supports empty args	Antoine Humeau	Colleen Dunlap	"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.
"	Bug	closed	Database layer (models, ORM)	5.2	Release blocker	fixed		Simon Charette	Ready for checkin	1	0	0	0	0	0
