#24814: Unable to order_by an ArrayField element.
----------------------------------+--------------------------------------
     Reporter:  schinckel         |                    Owner:
         Type:  Uncategorized     |                   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 schinckel):

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


Old description:

> It seems logical that, given a model Foo, with ArrayField bar, we should
> be able to (using the same rules for querying), perform:
>
>     Foo.objects.order_by('bar__0')
>
> However, this does not work. Is this something that _should_ be made to
> work?
>
> It is possible to perform this query using an OrderBy(RawSQL()) thing,
> but that's a bit hard to figure out.
>
> It's worth pointing out that the same limitation applies to Hstore
> fields, and will apply to JSON fields.
>
> At the very least, this should perhaps be documented?

New description:

 It seems logical that, given a model Foo, with ArrayField bar, we should
 be able to (using the same rules for querying), perform:

 {{{
     Foo.objects.order_by('bar__0')
 }}}

 However, this does not work. Is this something that _should_ be made to
 work?

 It is possible to perform this query using an OrderBy(RawSQL()) thing, but
 that's a bit hard to figure out.

 It's worth pointing out that the same limitation applies to Hstore fields,
 and will apply to JSON fields.

 At the very least, this should perhaps be documented?

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24814#comment:1>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.3fb147ebdb2d69eeea61f6556da519b6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to