#35147: Unexcepted behaviour for the filter() method of the QuerySet in version 5.0.1 -------------------------------------+------------------------------------- Reporter: Darbados | Owner: nobody Type: Bug | Status: new Component: Database | Version: 5.0 layer (models, ORM) | Keywords: annotate, bitand, Severity: Normal | filter Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- Hi team,
I faced an unexpected behaviour of the bitand method of the F model when used with a BigIntField value. The change is that when I try to annotate and then filter on the promoted field, the query set is always empty, when it shouldn't be. Code is as follows: {{{ records_qs = Model.objects.annotate(flag_some_flag=F("flags").bitand(2**34)).filter(flag_some_flag=2**34) }}} The returned queryset is empty, but it shouldn't be. Simple test with using only annotate and further filtration using python list comprehension from the queryset using the annotated field, returns the needed records. The filtration works properly for flag values < {{{ 2**31 }}}. I was looking for some notes in the Django 5 release notes, but I found nothing, and this is the version where the problem is faced. With Django 4.2.8 this problem is not faced. Regards, Petar Netev -- Ticket URL: <https://code.djangoproject.com/ticket/35147> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018d4c6e2332-e7d5b81a-5b69-482a-bdbc-ef31d8e68011-000000%40eu-central-1.amazonses.com.