Re: [Django] #27693: Case insensitive lookups on JSONField nested values

2017-01-06 Thread Django
#27693: Case insensitive lookups on JSONField nested values
-+-
 Reporter:  Harris Lapiroff  |Owner:  Simon
 |  Charette 
 Type:  Bug  |   Status:  closed
Component:  contrib.postgres |  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette ):

 * owner:  (none) => Simon Charette 
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"d976760260c2d8371c1535a7bdeba9a2e0568a34" d9767602]:
 {{{
 #!CommitTicketReference repository=""
 revision="d976760260c2d8371c1535a7bdeba9a2e0568a34"
 Fixed #27693, Refs #27257 -- Fixed iexact lookup on JSONField keys.

 Thanks Harris Lapiroff for the report.
 }}}

--
Ticket URL: 
Django 
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/072.1711169028faad41f3bd404321bf2a7e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27693: Case insensitive lookups on JSONField nested values

2017-01-06 Thread Django
#27693: Case insensitive lookups on JSONField nested values
-+-
 Reporter:  Harris Lapiroff  |Owner:  (none)
 Type:  Bug  |   Status:  new
Component:  contrib.postgres |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * stage:  Accepted => Ready for checkin


--
Ticket URL: 
Django 
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/072.aeb0bcab0ec79ee612a38788f258a554%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27693: Case insensitive lookups on JSONField nested values

2017-01-05 Thread Django
#27693: Case insensitive lookups on JSONField nested values
--+
 Reporter:  Harris Lapiroff   |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  master
 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
--+
Changes (by Simon Charette):

 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/7800 PR]

--
Ticket URL: 
Django 
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/072.0af5f7d1917931ae94ed4befa180a101%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27693: Case insensitive lookups on JSONField nested values

2017-01-05 Thread Django
#27693: Case insensitive lookups on JSONField nested values
--+
 Reporter:  Harris Lapiroff   |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Simon Charette):

 * version:  1.10 => master
 * type:  New feature => Bug
 * stage:  Unreviewed => Accepted


Comment:

 It looks like the iexact case was overlooked by #27257. It believe it
 would be a simple matter of defining a
 `KeyTransformIExact(KeyTransformTextLookupMixin, builtin_lookups.IExact)`
 subclass and registering it as a `KeyTransform` lookup. See
 cecef94275118dc49a1b0d89d3ca9734e2ec9776.

--
Ticket URL: 
Django 
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/072.e092ea53e5c76c7dfd54a77a63fde17c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27693: Case insensitive lookups on JSONField nested values

2017-01-05 Thread Django
#27693: Case insensitive lookups on JSONField nested values
--+--
 Reporter:  Harris Lapiroff   |Owner:  (none)
 Type:  New feature   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 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
--+--

Comment (by melinath):

 Just tested this on master, and I can confirm that the iexact lookup works
 - except that you need to add the quotes for the query in yourself. i.e.

 {{{
 >>> x = OrganizationPerson.objects.first()
 >>> x.data
 {'field2': 'Ethelfort'}
 >>> OrganizationPerson.objects.filter(data__field2__iexact='Ethelfort')
 
 >>> OrganizationPerson.objects.filter(data__field2__iexact='"Ethelfort"')
 ]>
 }}}

 Knowing how the SQL ends up looking, this sort of makes sense to me - but
 if I didn't know that from this ticket I would be completely lost.

--
Ticket URL: 
Django 
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/072.4791a35fda7a61dea392b2c20c19cc2e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27693: Case insensitive lookups on JSONField nested values

2017-01-05 Thread Django
#27693: Case insensitive lookups on JSONField nested values
--+--
 Reporter:  Harris Lapiroff   |Owner:  (none)
 Type:  New feature   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 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
--+--

Comment (by Tim Graham):

 Did you reproduce this on master? I thought it might be fixed by #27257 --
 Fixed builtin text lookups on JSONField keys.

--
Ticket URL: 
Django 
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/072.4be816a45bb82fa04efe224912b80d56%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27693: Case insensitive lookups on JSONField nested values

2017-01-05 Thread Django
#27693: Case insensitive lookups on JSONField nested values
+
   Reporter:  Harris Lapiroff   |  Owner:  (none)
   Type:  New feature   | Status:  new
  Component:  contrib.postgres  |Version:  1.10
   Severity:  Normal|   Keywords:
   Triage Stage:  Unreviewed|  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+
 Currently `JSONField` doesn't support case-insensitive lookups such as
 `iexact`. This is not documented as working, so I'm marking this as a new
 feature, but it's something I think Django ''can'' and should support.

 Attempting to use an `iexact` lookup (e.g.,
 `OrganizationPerson.objects.filter(data__field2__iexact='Ethelfort')`)
 results in a SQL error:

 {{{
 django.db.utils.ProgrammingError: function upper(jsonb) does not exist
 LINE 1: ...st" FROM "organizations_organizationperson" WHERE UPPER("org...
  ^
 HINT:  No function matches the given name and argument types. You might
 need to add explicit type casts.
 }}}

 I believe this is just a case of misplaced parens and quotes. Similar
 functionality (though still not documented) ''does'' work on
 `HStoreField`s. Here's an example of the successful SQL Django generates
 for an `iexact` lookup on an `HStoreField`.

 {{{
 SELECT "organizations_organizationperson"."id",
 "organizations_organizationperson"."organization_id",
 "organizations_organizationperson"."person_id",
 "organizations_organizationperson"."data",
 "organizations_organizationperson"."test" FROM
 "organizations_organizationperson" WHERE
 UPPER(("organizations_organizationperson"."test" -> 'foo')::text) =
 UPPER('Bar') LIMIT 21
 }}}

 And here's the ''unsuccessful'' SQL Django generates for an `iexact`
 lookup on a `JSONField`, which generates the error above:

 {{{
 SELECT "organizations_organizationperson"."id",
 "organizations_organizationperson"."organization_id",
 "organizations_organizationperson"."person_id",
 "organizations_organizationperson"."data",
 "organizations_organizationperson"."test" FROM
 "organizations_organizationperson" WHERE
 UPPER("organizations_organizationperson"."data" -> 'field2'::text) =
 UPPER('Ethelfort') LIMIT 21
 }}}

 I don't have an ORM-level fix for correcting the query, but a proper query
 that works as expected just includes a couple more parens and quotes in
 the `WHERE` clause:

 {{{
 SELECT "organizations_organizationperson"."id",
 "organizations_organizationperson"."organization_id",
 "organizations_organizationperson"."person_id",
 "organizations_organizationperson"."data",
 "organizations_organizationperson"."test" FROM
 "organizations_organizationperson" WHERE
 UPPER(("organizations_organizationperson"."data" -> 'field2')::text) =
 UPPER('"Ethelfort"') LIMIT 21
 }}}

--
Ticket URL: 
Django 
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/057.3f00c04d55481ed8043c67452ec03994%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.