Changes between Initial Version and Version 1 of Ticket #37470
- Timestamp:
- Nov 3, 2026, 1:45:25 AM (98 minutes ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #37470 – Description
initial v1 31 31 32 32 {{{#!python 33 from django.db.models import BooleanField, ExpressionWrapper, Q 34 35 always_false = ~ExpressionWrapper(~Q(pk__in=[]), output_field=BooleanField()) 36 Item.objects.filter(always_false) # Expected: no rows. Actual: all rows. 37 Item.objects.annotate(x=always_false) # Expected: x=False. Actual: x=True. 38 }}} 39 40 {{{#!python 33 41 always_false = ~ExpressionWrapper(~Q(pk__in=[]), output_field=BooleanField()) 34 42 Item.objects.filter(always_false) # Expected: no rows. Actual: all rows. … … 40 48 Adding an `except FullResultSet: raise EmptyResultSet` branch to `NegatedExpression.as_sql()` fixes it: the reproduction tests pass and the full test suite passes on SQLite with that change. I haven't tested other backends yet. I'd like to submit a PR with a regression test. 41 49 42 With this change the reproduction tests pass and the full test suite passes on SQLite. I haven't tested other backends yet.43 44 50 Reproduced on main (b501b8493f) with SQLite. 45 51