#35778: Use native JSONObject on Postgres 16+ with server side bindings
-------------------------------------+-------------------------------------
     Reporter:  john-parton          |                    Owner:  john-
                                     |  parton
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     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
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 Another con of changing `::` at this point is that will change the SQL
 generated in any usage `Cast` in expression indices which might cause
 people these indices not to be used anymore when users upgrade their
 version of Django.

 For example, say that you have a model of the form

 {{{#!python
 class People(models.Model):
     phone_number = models.IntegerField()

     class Meta:
         indexes = [
             Index(name="phone_number_str", Cast("phone_number",
 models.TextField()))
         ]
 }}}

 Then the resulting index will be on `(phone_number)::text` and queries of
 the form `filter(phone_number__startswith="123")` will generate `WHERE
 (phone_number)::text LIKE '123%'` will be able to use the index.

 If we change `Cast` to use `CAST` instead of `::` are confident that the
 Postgres planer will be smart enough to use the pre-existing
 `(phone_number)::text` it for queries of the form `CAST(phone_number AS
 text) LIKE '123%'`? From past experience the expression has to exactly
 match for the planner to consider the index and we can't expect users to
 rebuild all of their indices every time they upgrade their Django version.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35778#comment:11>
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/010701924e35335d-36889f0f-51b2-4e52-a716-1923dda87aea-000000%40eu-central-1.amazonses.com.

Reply via email to