[Django] #34080: Postgresql/ArrayField: exact filter on NULL nested arrays fails

4 views
Skip to first unread message

Django

unread,
Oct 10, 2022, 4:15:56 AM10/10/22
to django-...@googlegroups.com
#34080: Postgresql/ArrayField: exact filter on NULL nested arrays fails
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
yetanotherion |
Type: Bug | Status: new
Component: Database | Version: 4.1
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
PR:
https://github.com/pricemoov/django/pull/2/files

How to reproduce:
tox -e py39-postgres -- --settings=test_postgres
postgres_tests.test_array.TestQuerying

{{{
django.db.utils.DataError: invalid input syntax for type integer:
"{NULL,NULL}"
LINE 1: ...ullableintegerarraymodel"."field_nested" = (ARRAY['{NULL,NUL...

}}}


The error seems to be due to the query being generated as

{{{
...ARRAY['{NULL,NULL}']...

}}}

instead of

{{{
...ARRAY[ARRAY[NULL,NULL]]...

}}}

Note that the bug is not reproduced if at **least one** of the elements in
the nested array is **not null**.

--
Ticket URL: <https://code.djangoproject.com/ticket/34080>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages