[Django] #23709: postgres ArrayField can't access specific array indices in .values(), .aggregate(), etc.

26 views
Skip to first unread message

Django

unread,
Oct 23, 2014, 7:08:15 PM10/23/14
to django-...@googlegroups.com
#23709: postgres ArrayField can't access specific array indices in .values(),
.aggregate(), etc.
----------------------------------+------------------------
Reporter: kalenedrael | Owner:
Type: Uncategorized | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Keywords: arrayfield
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------
ArrayField allows lookups by index when filtering, e.g.
{{{
qset.filter(arr__0=foo)
}}}
but things like
{{{
qset.values('arr__0')
qset.aggregate(Max('arr__0')
}}}
are not allowed.

I'm not sure if this counts as a feature request or bug. From a cursory
look at the Django source it seems that this functionality may not be
compatible with the way Django handles lookups outside of .filter().

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

Django

unread,
Oct 23, 2014, 7:08:55 PM10/23/14
to django-...@googlegroups.com
#23709: postgres ArrayField can't access specific array indices in .values(),
.aggregate(), etc.
----------------------------------+--------------------------------------

Reporter: kalenedrael | Owner:
Type: Uncategorized | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:

Keywords: arrayfield | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Old description:

> ArrayField allows lookups by index when filtering, e.g.
> {{{
> qset.filter(arr__0=foo)
> }}}
> but things like
> {{{
> qset.values('arr__0')
> qset.aggregate(Max('arr__0')
> }}}
> are not allowed.
>
> I'm not sure if this counts as a feature request or bug. From a cursory
> look at the Django source it seems that this functionality may not be
> compatible with the way Django handles lookups outside of .filter().

New description:

ArrayField allows lookups by index when filtering, e.g.
{{{
qset.filter(arr__0=foo)
}}}
but things like
{{{
qset.values('arr__0')

qset.aggregate(Max('arr__0'))
}}}
are not allowed.

I'm not sure if this counts as a feature request or bug. From a cursory
look at the Django source it seems that this functionality may not be
compatible with the way Django handles lookups outside of .filter().

--

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

Django

unread,
Oct 24, 2014, 2:02:33 AM10/24/14
to django-...@googlegroups.com
#23709: postgres ArrayField can't access specific array indices in .values(),
.aggregate(), etc.
----------------------------------+------------------------------------

Reporter: kalenedrael | Owner:
Type: Uncategorized | Status: new
Component: contrib.postgres | Version: master
Severity: Normal | Resolution:
Keywords: arrayfield | Triage Stage: Accepted

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

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

* stage: Unreviewed => Accepted


Comment:

This is something that we want to allow, but we just haven't gotten there
yet.

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

Django

unread,
Oct 31, 2014, 8:47:15 AM10/31/14
to django-...@googlegroups.com
#23709: postgres ArrayField can't access specific array indices in .values(),
.aggregate(), etc.
----------------------------------+------------------------------------
Reporter: kalenedrael | Owner:
Type: New feature | Status: new
Component: contrib.postgres | Version: master

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

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

* type: Uncategorized => New feature


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

Django

unread,
May 4, 2015, 7:28:39 PM5/4/15
to django-...@googlegroups.com
#23709: postgres ArrayField can't access specific array indices in .values(),
.aggregate(), etc.
----------------------------------+-------------------------------------
Reporter: kalenedrael | Owner:
Type: New feature | Status: closed
Component: contrib.postgres | Version: master
Severity: Normal | Resolution: duplicate

Keywords: arrayfield | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => closed
* resolution: => duplicate


Comment:

Closing as a duplicate of https://code.djangoproject.com/ticket/24747

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

Reply all
Reply to author
Forward
0 new messages