Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2023-03-21 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
-+-
 Reporter:  Jerome Leclanche |Owner:  (none)
 Type:  Bug  |   Status:  new
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:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * owner:  VCAMP => (none)
 * status:  assigned => new


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070187037c2025-c2ec9ac3-5167-4d42-ba1c-daeb55ecdeeb-00%40eu-central-1.amazonses.com.


Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2021-01-15 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
-+-
 Reporter:  Jerome Leclanche |Owner:  VCAMP
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * component:  contrib.postgres => Database layer (models, ORM)


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.444c949257628d072361f9da3407bb47%40djangoproject.com.


Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2020-05-20 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
--+
 Reporter:  Jerome Leclanche  |Owner:  VCAMP
 Type:  Bug   |   Status:  assigned
Component:  contrib.postgres  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+
Changes (by felixxm):

 * version:  1.11 => master


Comment:

 With the new implementation of `JSONField` this issue is PostgreSQL-
 specific.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.274af847ebaaced3c2f49dd35bbfc612%40djangoproject.com.


Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2018-11-06 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
--+
 Reporter:  Jerome Leclanche  |Owner:  VCAMP
 Type:  Bug   |   Status:  assigned
Component:  contrib.postgres  |  Version:  1.11
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

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


Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2018-11-02 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
--+
 Reporter:  Jerome Leclanche  |Owner:  VCAMP
 Type:  Bug   |   Status:  assigned
Component:  contrib.postgres  |  Version:  1.11
 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 VCAMP):

 * cc: VCAMP (added)
 * 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/068.a81021664c82ab5e6a4eeb048e2ac6e0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2018-10-26 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
--+
 Reporter:  Jerome Leclanche  |Owner:  VCAMP
 Type:  Bug   |   Status:  assigned
Component:  contrib.postgres  |  Version:  1.11
 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 VCAMP):

 * owner:  (none) => VCAMP
 * status:  new => assigned


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


Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2017-12-27 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
--+
 Reporter:  Jerome Leclanche  |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.11
 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 Tim Graham):

 * stage:  Unreviewed => Accepted


Old description:

> Prerequisites
>
> 1. Create a model MyModel1 with the field `resource = JSONField()`.
> 2. Create another model MyModel2 with a field `id =
> CharField(max_length=255)`
>
> Reproduce by doing
> `MyModel1.objects.filter(resource__foo__id__in=MyModel2.objects.all().values_list("id"))`
>
> Expected result: Should look at MyModel1 for objects with `resource`
> matching `{"foo": {"id": }}`.
>
> Actual result:
>
> ERROR:  operator does not exist: jsonb = character varying
> LINE 1: ...AND ("resource" #> '{foo,id}') IN (SELECT...
>
> The actual issue is that when passing a values_list() to __in, the values
> list is not cast to jsonb (unlike when passing a text type). In the
> resulting sql, we can see `IN (SELECT U0."id" AS Col1 FROM mymodel2 U0
> ...)`. Wrapping `to_json(U0."id")` solves the issue.

New description:

 Prerequisites

 1. Create a model MyModel1 with the field `resource = JSONField()`.
 2. Create another model MyModel2 with a field `id =
 CharField(max_length=255)`

 Reproduce by doing
 
`MyModel1.objects.filter(resource__foo__id__in=MyModel2.objects.all().values_list("id"))`

 Expected result: Should look at MyModel1 for objects with `resource`
 matching `{"foo": {"id": }}`.

 Actual result:
 {{{
 ERROR:  operator does not exist: jsonb = character varying
 LINE 1: ...AND ("resource" #> '{foo,id}') IN (SELECT...
 }}}
 The actual issue is that when passing a `values_list()` to `__in`, the
 values list is not cast to jsonb (unlike when passing a text type). In the
 resulting sql, we can see `IN (SELECT U0."id" AS Col1 FROM mymodel2 U0
 ...)`. Wrapping `to_json(U0."id")` solves the issue.

--

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


Re: [Django] #28872: JSONField __in operator breaks when given a values_list()

2017-12-01 Thread Django
#28872: JSONField __in operator breaks when given a values_list()
--+--
 Reporter:  Jerome Leclanche  |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.11
 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
--+--
Description changed by Jerome Leclanche:

Old description:

> Prerequisites
>
> 1. Create a model MyModel1 with the field `resource = JSONField()`.
> 2. Create another model MyModel2 with a field `id =
> CharField(max_length=255)`
>
> Reproduce by doing
> MyModel1.objects.filter(resource__foo__id__in=MyModel2.objects.all().values_list("id"))
>
> Expected result: Should look at MyModel1 for objects with `resource`
> matching `{"foo": {"id": }}`.
>
> Actual result:
>
> ERROR:  operator does not exist: jsonb = character varying
> LINE 1: ...AND ("resource" #> '{foo,id}') IN (SELECT...
>
> The actual issue is that when passing a values_list() to __in, the values
> list is not cast to jsonb (unlike when passing a text type). In the
> resulting sql, we can see `IN (SELECT U0."id" AS Col1 FROM mymodel2 U0
> ...)`. Wrapping `to_json(U0."id")` solves the issue.

New description:

 Prerequisites

 1. Create a model MyModel1 with the field `resource = JSONField()`.
 2. Create another model MyModel2 with a field `id =
 CharField(max_length=255)`

 Reproduce by doing
 
`MyModel1.objects.filter(resource__foo__id__in=MyModel2.objects.all().values_list("id"))`

 Expected result: Should look at MyModel1 for objects with `resource`
 matching `{"foo": {"id": }}`.

 Actual result:

 ERROR:  operator does not exist: jsonb = character varying
 LINE 1: ...AND ("resource" #> '{foo,id}') IN (SELECT...

 The actual issue is that when passing a values_list() to __in, the values
 list is not cast to jsonb (unlike when passing a text type). In the
 resulting sql, we can see `IN (SELECT U0."id" AS Col1 FROM mymodel2 U0
 ...)`. Wrapping `to_json(U0."id")` solves the issue.

--

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