#25579: Lack of type adaptation in ArrayField querying/lookups
-------------------------------------+-------------------------------------
     Reporter:  freshquiz            |                    Owner:  freshquiz
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.postgres     |                  Version:  1.8
     Severity:  Normal               |               Resolution:
     Keywords:  ArrayField query     |             Triage Stage:  Accepted
  lookup                             |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by freshquiz:

Old description:

> This commit:
> [https://github.com/django/django/commit/39d95fb6ada99c59d47fa0eae6d3128abafe2d58]
> replaces the `get_prep_value` method with `get_db_prep_value` and I
> believe this causes a regression with regards to querying on an
> ArrayField.
>
> `get_db_prep_value` is never called during querying/lookup, hence the
> array items/values are passed directly to the low-level database Python
> wrappers without first being transformed (from Python objects to SQL-
> friendly parameters).
>
> See this question: [http://stackoverflow.com/questions/33250371
> /arrayfield-class-missing-query-lookup-methods]
>
> Could both the `get_prep_value` and `get_db_prep_value` methods be
> overridden with duplicate/shared logic to overcome this issue?

New description:

 This commit:
 
[https://github.com/django/django/commit/39d95fb6ada99c59d47fa0eae6d3128abafe2d58]
 replaces the `get_prep_value` method with `get_db_prep_value` and I
 believe this causes a regression with regards to querying on an
 ArrayField.

 `get_db_prep_value` is never called during querying/lookup, hence the
 array items/values are passed directly to the low-level database Python
 wrappers without first being transformed (from Python objects to SQL-
 friendly parameters).

 See this question: [http://stackoverflow.com/questions/33250371
 /arrayfield-class-missing-query-lookup-methods]

 Could both the `get_prep_value` and `get_db_prep_value` methods be
 overridden with duplicate/shared logic to overcome this issue?

 Patch pull request: [https://github.com/django/django/pull/6278]

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25579#comment:8>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.008632106b75f6080589f5876c67f65b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to