#27095: Queries involving postgres Array fields can't include expressions as elements ----------------------------------------------+-------------------- Reporter: MatthewWilkes | Owner: nobody Type: Uncategorized | Status: new Component: Database layer (models, ORM) | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------------------------+-------------------- Issue #22288 allows use of expressions in lookups that take iterables rather than single items directly. This allows, for example:
{{{ NullableIntegerArrayModel.objects.filter(field__in=[models.F('field')]), }}} i.e., filtering an ArrayField using `__in` with expressions that evaluate to other ArrayField references. However, the following fails: {{{ NullableIntegerArrayModel.objects.filter(field__in=[[models.F('id')]]), }}} i.e., building a new array that contains scalar expressions. There are some tests, marked with expectedFailure, in `postgres_tests.test_array`: `test_in_including_F_object` and `test_contained_by_including_F_object`, that demonstrate this problem. -- Ticket URL: <https://code.djangoproject.com/ticket/27095> 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 post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/056.adc8c89e6c08df7134ec599a85e7169d%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.