Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-07 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+-
 Reporter:  jrhouston |Owner:
 Type:  Bug   |   Status:  closed
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:  duplicate
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  1 |UI/UX:  0
--+-
Changes (by charettes):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 I think we can close as duplicate is this case. The proposed tests don't
 add much value to the suite.

--
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/067.bd73e8df7015dbcea1eed31e9455e9f4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-07 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+
 Reporter:  jrhouston |Owner:
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  1 |UI/UX:  0
--+

Comment (by timgraham):

 A related ticket is #26908. My [https://github.com/django/django/pull/6929
 PR] for that ticket also adds the parentheses.

--
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/067.131a1e7fe651b7a5e53fb392b7852213%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-06 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+
 Reporter:  jrhouston |Owner:
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  1 |UI/UX:  0
--+

Comment (by charettes):

 @jrhouston, the following should do:

 {{{#!python
 from django.contrib.postgres.fields.jsonb import KeyTransform
 from django.db.functions import Cast

 instance = JSONModel.objects.create(field={'foo': 123})
 foo = JSONModel.objects.annotate(
 foo=Cast(KeyTransform('foo', 'field'), models.IntegerField())
 ).values_list('foo', flat=True).get(pk=instance.pk)
 self.assertEqual(foo, 123)
 }}}

--
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/067.757fa9fc23640aff7175fce33839765a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-06 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+
 Reporter:  jrhouston |Owner:
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  1 |UI/UX:  0
--+

Comment (by jrhouston):

 @charettes in your last comment are you referring to the use of the
 regex/iregex lookup used in the pull request, and if so could you suggest
 an alternative lookup that I could use to test this?

--
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/067.0b6ec38a16a69098ff56492149bd9090%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-05 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+
 Reporter:  jrhouston |Owner:
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  1 |UI/UX:  0
--+
Changes (by charettes):

 * stage:  Unreviewed => Accepted


Comment:

 While working on #26511 I also noticed we should wrap the key access
 expression
 [https://github.com/django/django/compare/django:9a2a525...charettes:05b5792
 #diff-57ceaae67721b3f8d5729222c032af8eR85 in parentheses].

 @jrhouston you might be interested to know  that `(field -> key)::text` is
 going to get you the text representation of the JSON key you're accessing
 (`'(('{"foo": "bar"}'::jsonb) -> 'bar')::text` will get you `'"bar"'`.
 What you want to use here is the `->>` operator (`('{"foo":
 "bar"}'::jsonb) ->> 'bar'` == `'bar'`).

 I'm not sure how we can teach the ORM to use `->>` in a backward
 compatible way at this point, we might have to introduce a new expression
 for this purpose like I suggested in  #26511.

 In the mean time I propose [https://github.com/django/django/pull/7210 we
 add these parentheses] but it would be great to have regression tests not
 relying on built-in lookups meant to be only available on `CharField` or
 `TextField` as their removal or replacement are tracked in another ticket
 if I'm not mistaken.

--
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/067.db9edbec2af32425cf13e3b8e7be55ee%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-05 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+--
 Reporter:  jrhouston |Owner:
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Unreviewed
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  1 |UI/UX:  0
--+--
Changes (by jrhouston):

 * has_patch:  0 => 1


--
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/067.e31657422be48f560bb277a9d76a4242%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-05 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+--
 Reporter:  jrhouston |Owner:
 Type:  Bug   |   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:  1 |UI/UX:  0
--+--
Changes (by DavidFozo):

 * owner:  DavidFozo =>
 * status:  assigned => new


Comment:

 Someone wrote a patch, before I did.

--
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/067.389a9974065504d8b3a3935cb439ab58%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27179: Bug: error when trying to filter using regex/iregex on a key in a django.contrib.postgres.fields.JSONField

2016-09-05 Thread Django
#27179: Bug: error when trying to filter using regex/iregex on a key in a
django.contrib.postgres.fields.JSONField
--+--
 Reporter:  jrhouston |Owner:  DavidFozo
 Type:  Bug   |   Status:  assigned
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:  1 |UI/UX:  0
--+--
Changes (by DavidFozo):

 * owner:   => DavidFozo
 * needs_better_patch:   => 0
 * status:  new => assigned
 * needs_tests:   => 0
 * needs_docs:   => 0


--
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/067.434f767cab8af7a28d998b8b09e6c4e2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.