[Django] #25666: ArrayField exact querying doesn't work with CharField

28 views
Skip to first unread message

Django

unread,
Nov 3, 2015, 4:38:16 AM11/3/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
----------------------------------+-----------------
Reporter: ecederstrand | Owner:
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+-----------------
This is a variation of https://code.djangoproject.com/ticket/22907, except
with `=` instead of `__contains`. When trying to make an exact match on a
char ArrayField:

{{{#!python
CharArrayModel.objects.filter(field=['text'])
}}}

I get:
{{{
ProgrammingError: operator does not exist: character varying[] = text[]
LINE 1: ...el" WHERE "postgres_tests_chararraymodel"."field" = ARRAY['...
^
HINT: No operator matches the given name and argument type(s). You might
need to add explicit type casts.
}}}

The same happens if I use `__exact`.

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

Django

unread,
Nov 3, 2015, 4:46:59 AM11/3/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
----------------------------------+--------------------------------------

Reporter: ecederstrand | Owner:
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by ecederstrand):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

I stumbled upon this because I was trying to edit a `unique=True`
ArrayField via the admin. Before saving, the admin does a check along the
lines of
{{{CharArrayModel.objects.filter(field=['my_new_text']).exclude(pk=self.pk)}}}.

--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:1>

Django

unread,
Nov 7, 2015, 8:30:13 AM11/7/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
----------------------------------+--------------------------------------

Reporter: ecederstrand | Owner:
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Stranger6667):

* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/5575

--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:2>

Django

unread,
Nov 7, 2015, 9:02:03 AM11/7/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
----------------------------------+--------------------------------------

Reporter: ecederstrand | Owner:
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by charettes):

#25091 was a duplicate.

--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:3>

Django

unread,
Nov 7, 2015, 9:59:46 AM11/7/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
----------------------------------+------------------------------------

Reporter: ecederstrand | Owner:
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by yakky):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:4>

Django

unread,
Nov 7, 2015, 1:18:58 PM11/7/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
----------------------------------+----------------------------------------
Reporter: ecederstrand | Owner: Stranger6667
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 1.8

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+----------------------------------------
Changes (by Stranger6667):

* owner: => Stranger6667
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:5>

Django

unread,
Nov 14, 2015, 10:59:28 AM11/14/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
-------------------------------------+-------------------------------------

Reporter: ecederstrand | Owner:
| Stranger6667
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:6>

Django

unread,
Nov 14, 2015, 11:21:51 AM11/14/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
-------------------------------------+-------------------------------------
Reporter: ecederstrand | Owner:
| Stranger6667
Type: Bug | Status: closed
Component: contrib.postgres | Version: 1.8
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"263b3d2ba132ea443193dc0b728741317742c8d3" 263b3d2b]:
{{{
#!CommitTicketReference repository=""
revision="263b3d2ba132ea443193dc0b728741317742c8d3"
Fixed #25666 -- Fixed the exact lookup of ArrayField.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:7>

Django

unread,
Nov 14, 2015, 11:29:15 AM11/14/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
-------------------------------------+-------------------------------------
Reporter: ecederstrand | Owner:
| Stranger6667
Type: Bug | Status: closed
Component: contrib.postgres | Version: 1.8

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"e9c9f2ed82bd59b211f5f449730ad1299cfdd3c1" e9c9f2ed]:
{{{
#!CommitTicketReference repository=""
revision="e9c9f2ed82bd59b211f5f449730ad1299cfdd3c1"
[1.8.x] Fixed #25666 -- Fixed the exact lookup of ArrayField.

Backport of 263b3d2ba132ea443193dc0b728741317742c8d3 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:8>

Django

unread,
Nov 14, 2015, 11:29:18 AM11/14/15
to django-...@googlegroups.com
#25666: ArrayField exact querying doesn't work with CharField
-------------------------------------+-------------------------------------
Reporter: ecederstrand | Owner:
| Stranger6667
Type: Bug | Status: closed
Component: contrib.postgres | Version: 1.8

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"fe79bc3ed97bbc719dba3e91eebfee3016b5e55a" fe79bc3e]:
{{{
#!CommitTicketReference repository=""
revision="fe79bc3ed97bbc719dba3e91eebfee3016b5e55a"
[1.9.x] Fixed #25666 -- Fixed the exact lookup of ArrayField.

Backport of 263b3d2ba132ea443193dc0b728741317742c8d3 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25666#comment:9>

Reply all
Reply to author
Forward
0 new messages