#26327: Add JSON_AGG to contrib.postgres
-------------------------------------+-------------------------------------
     Reporter:  Tomasz Nowak         |                    Owner:  (none)
         Type:  New feature          |                   Status:  new
    Component:  contrib.postgres     |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  JSON postgres        |             Triage Stage:  Accepted
  aggregate                          |
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 > Would it make more sense to augment it so it's easier to aggregate
 several fields, or is this something that's better done in Python?

 This can be done in a future iteration if required.

 > Also, JSONB is only available in 9.4+, so maybe some version checking
 would be a good idea?

 You could throw an error by overriding `as_sql()` but I think a note in
 the documentation would be enough.

 > It might be slightly misleading that the JSON-datatype in
 django.contrib.postgres.fields is actually jsonb.

 Agreed but lets not perpetuate this by naming the class `JsonbAgg`
 instead.

 I find it a bit odd that we convert `None` to `''` for `StringConcat` as
 it's not something we do for other aggregates (`Count(NULL)` is not
 converted to `0`) and I'm not sure this is something we want to do for
 this aggregate as well. I can see a use case for having `JsonbAgg` return
 `None` and nothing prevents the users from wrapping the expression in a
 `Coalesce` if that's not what they expect.

--
Ticket URL: <https://code.djangoproject.com/ticket/26327#comment:3>
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/065.1a46a2002f0bfd85284fa92d46550095%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to