Here is a code example:
{{{
queryset_union = queryset_a.union(queryset_b)
queryset_union.filter(key=value)
}}}
The last command has no effect. Ideally, it should apply the requested
filter. However, from the [docs
comment](https://docs.djangoproject.com/en/2.2/ref/models/querysets/#union)
the following:
> In addition, only LIMIT, OFFSET, COUNT(*), ORDER BY, and specifying
columns (i.e. slicing, count(), order_by(), and values()/values_list())
are allowed on the resulting QuerySet. Further, databases place
restrictions on what operations are allowed in the combined queries. For
example, most databases don’t allow LIMIT or OFFSET in the combined
queries.
Therefore, without adding the functionality, it would make sense to
trigger a warning or raise an exception, such that users are aware that
their filter statement did not succeed. IMO this seems like a
`NotImplementedError`. However, a warning would be more backwards
compatible.
--
Ticket URL: <https://code.djangoproject.com/ticket/30639>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* type: Uncategorized => Bug
* version: 2.2 => master
* resolution: => duplicate
Comment:
Duplicate of #27995.
--
Ticket URL: <https://code.djangoproject.com/ticket/30639#comment:1>