#35718: Some useful postgres functions for JSON are missing from contrib
----------------------------------+---------------------------------------
     Reporter:  john-parton       |                    Owner:  john-parton
         Type:  New feature       |                   Status:  assigned
    Component:  contrib.postgres  |                  Version:  dev
     Severity:  Normal            |               Resolution:
     Keywords:                    |             Triage Stage:  Unreviewed
    Has patch:  1                 |      Needs documentation:  1
  Needs tests:  1                 |  Patch needs improvement:  1
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+---------------------------------------
Comment (by Simon Charette):

 If we are going to add these functions they should support SQLite, MySQL,
 and Oracle as well otherwise they are trivial to implement using `Func`
 solely for Postgres and they don't belong in core in my opinion. They
 should live in `django.db.models.functions.json`.

 > jsonb_build_object
 > jsonb_build_array
 > jsonb_array_elements

 Seems like good candidate.

 > jsonb_extract_path
 > jsonb_extract_path_text

 Per the Postgres docs you linked

 > This is functionally equivalent to the #> operator, but writing the path
 out as a variadic list can be more convenient in some cases.

 Already achievable using the `__` syntax and `KT`
 [https://docs.djangoproject.com/en/5.1/topics/db/queries/#module-
 django.db.models.fields.json objects] so not worth adding IMO. You only
 have to join your array as string.

 > jsonb_array_length

 Also not convinced this is warranted given
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35718#comment:4>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191a08d83db-65dabd25-6f4e-47da-9140-58bb3eca5610-000000%40eu-central-1.amazonses.com.

Reply via email to