Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-06-11 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
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
-+-
Changes (by VIZZARD-X):

 * needs_better_patch:  1 => 0
 * needs_tests:  1 => 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019eb780be97-4e790b57-1fd5-46ec-8202-b31839a043ca-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-04-12 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  0 => 1
 * needs_tests:  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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d832785f7-4e898b37-27cc-420b-8ea5-eb802d64420e-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-04-10 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
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
-+-
Changes (by VIZZARD-X):

 * 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d78422a3b-72d6415b-2754-4ef0-8a6c-1151845dba2b-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-04-10 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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
-+-
Comment (by VIZZARD-X):

 [https://github.com/django/django/pull/21086 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d7841b2ac-3661f9b4-3c8a-44e2-b2a5-52ca370ec9dc-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-24 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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 Jacob Walls):

 * has_patch:  1 => 0
 * stage:  Ready for checkin => Accepted

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d21d78b6c-f8d43151-c39b-482a-a613-f6a759231f50-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-24 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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
-+-
Comment (by GitHub ):

 In [changeset:"386257b33eb2a925cecc1a12ba5e7dd694617186" 386257b3]:
 {{{#!CommitTicketReference repository=""
 revision="386257b33eb2a925cecc1a12ba5e7dd694617186"
 Refs #36494 -- Prevented crash in JSONField numeric lookups with
 expressions.
 }}}
-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d21d73610-6dc908d2-4782-4125-959a-07ee84eaca69-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-24 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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 Clifford Gama):

 * stage:  Accepted => Ready for checkin

Comment:

 Patch for numeric lookups looks good to me.
-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d1ee5b8ca-7a137816-47e8-4f9f-ab94-da253b7b8d42-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-23 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
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
-+-
Changes (by VIZZARD-X):

 * needs_better_patch:  1 => 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d1b5ff00b-53bd1cdf-c506-47c9-b47d-39e1055fd1b1-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-22 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
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 Clifford Gama):

 * 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d171e35d0-ede552d6-1599-4573-b777-7491e2e5a54c-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-19 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
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
-+-
Changes (by VIZZARD-X):

 * needs_better_patch:  1 => 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d05be6835-83966805-184d-44c8-b7bb-e56678a3767d-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-18 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  VIZZARD-X
 Type:   |   Status:  assigned
  Cleanup/optimization   |
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 Jacob Walls):

 * needs_better_patch:  0 => 1
 * owner:  Jacob Walls => VIZZARD-X

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d02b44b95-d4497989-cba4-49c0-beaf-423016b7c187-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-18 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  Jacob
 Type:   |  Walls
  Cleanup/optimization   |   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
-+-
Changes (by VIZZARD-X):

 * needs_better_patch:  1 => 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d0114bd9c-31401c34-6a1c-47c0-9cf2-fed784b4abbb-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-03-08 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  Jacob
 Type:   |  Walls
  Cleanup/optimization   |   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:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Clifford Gama):

 * needs_better_patch:  0 => 1

Comment:

 There's a PostgreSQL failure to look at:
 {{{#!python
 ==
 ERROR: test_numeric_lookup_with_expression
 (model_fields.test_jsonfield.TestQuerying.test_numeric_lookup_with_expression)
 --
 Traceback (most recent call last):
   File "/home/clifford/code/django/django/db/backends/utils.py", line 105,
 in _execute
 return self.cursor.execute(sql, params)
~~~^
   File "/home/clifford/.pyenv/versions/dj/lib/python3.14/site-
 packages/psycopg/cursor.py", line 117, in execute
 raise ex.with_traceback(None)
 psycopg.errors.UndefinedFunction: operator does not exist: jsonb > integer
 LINE 1: ...("model_fields_nullablejsonmodel"."value" -> 'c') > 999 LIMI...
  ^
 HINT:  No operator matches the given name and argument types. You might
 need to add explicit type casts.

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "/home/clifford/code/django/tests/model_fields/test_jsonfield.py",
 line 1299, in test_numeric_lookup_with_expression
 self.assertIs(qs_val.exists(), False)
   ~^^
   File "/home/clifford/code/django/django/db/models/query.py", line 1409,
 in exists
 return self.query.has_results(using=self.db)
~~^^^
   File "/home/clifford/code/django/django/db/models/sql/query.py", line
 681, in has_results
 return compiler.has_results()
^^
   File "/home/clifford/code/django/django/db/models/sql/compiler.py", line
 1599, in has_results
 return bool(self.execute_sql(SINGLE))
 
   File "/home/clifford/code/django/django/db/models/sql/compiler.py", line
 1631, in execute_sql
 cursor.execute(sql, params)
 ~~^
   File "/home/clifford/code/django/django/db/backends/utils.py", line 79,
 in execute
 return self._execute_with_wrappers(
~~~^
 sql, params, many=False, executor=self._execute
 ^^^
 )
 ^
   File "/home/clifford/code/django/django/db/backends/utils.py", line 92,
 in _execute_with_wrappers
 return executor(sql, params, many, context)
   File "/home/clifford/code/django/django/db/backends/utils.py", line 100,
 in _execute
 with self.db.wrap_database_errors:
  
   File "/home/clifford/code/django/django/db/utils.py", line 94, in
 __exit__
 raise dj_exc_value.with_traceback(traceback) from exc_value
   File "/home/clifford/code/django/django/db/backends/utils.py", line 105,
 in _execute
 return self.cursor.execute(sql, params)
~~~^
   File "/home/clifford/.pyenv/versions/dj/lib/python3.14/site-
 packages/psycopg/cursor.py", line 117, in execute
 raise ex.with_traceback(None)
 django.db.utils.ProgrammingError: operator does not exist: jsonb > integer
 LINE 1: ...("model_fields_nullablejsonmodel"."value" -> 'c') > 999 LIMI...
  ^
 HINT:  No operator matches the given name and argument types. You might
 need to add explicit type casts.

 --
 Ran 81 tests in 0.768s

 FAILED (errors=1, skipped=4)
 }}}
-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updat

Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2026-02-13 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  Jacob
 Type:   |  Walls
  Cleanup/optimization   |   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
-+-
Changes (by VIZZARD-X):

 * cc: VIZZARD-X (added)
 * has_patch:  0 => 1

Comment:

 PR https://github.com/django/django/pull/20702
-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019c5b13f9a6-58244c30-586c-410a-8c24-e02b076ca772-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2025-10-18 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  Jacob
 Type:   |  Walls
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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 Natalia Bidart):

 * stage:  Unreviewed => Accepted
 * type:  Bug => Cleanup/optimization

Comment:

 Thank you for the extra details, accepting on the basis to "invite PRs per
 lookup to either raise a better exception or add support if the effort is
 not massive".
-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070199c4340f77-34d3d788-4906-4cbd-87c5-dd5feb6e283f-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side

2025-10-18 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  Jacob
 |  Walls
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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
-+-
Changes (by Jacob Walls):

 * owner:  (none) => Jacob Walls
 * 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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070199c4323153-1c7cb004-7c6d-45d4-9219-c36901ce551f-00%40eu-central-1.amazonses.com.


Re: [Django] #36494: Various failures in JSONField lookups when using expressions in right-hand side (was: Various failures for JSONField lookups and right-hand side subqueries)

2025-10-18 Thread Django
#36494: Various failures in JSONField lookups when using expressions in 
right-hand
side
-+-
 Reporter:  Jacob Walls  |Owner:  (none)
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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
-+-
Changes (by Jacob Walls):

 * resolution:  wontfix =>
 * status:  closed => new
 * summary:  Various failures for JSONField lookups and right-hand side
 subqueries =>
 Various failures in JSONField lookups when using expressions in right-
 hand side


Old description:

> After #35972, I worked on a
> [https://github.com/jacobtylerwalls/django/pull/2/files test] to verify
> support for `JSONField` lookups against right-hand side subqueries.
> Support is mostly complete on Postgres, but largely incomplete on other
> backends.
>
> I'm suggesting we close this ticket (in separate PRs) with a combination
> of adding support where possible (perhaps for `__range`?), with failing
> at the python layer with more appropriate exceptions, or possibly adding
> a feature flag to guard some failures. I agree with the
> [https://code.djangoproject.com/ticket/31779#comment:3 sentiment] that we
> cannot maintain endless feature flags for database quirks or insulate
> users from every bug in their database vendor, but some of these failures
> seem to me to be on the Django side.
>
> Postgres:
> 1. `__range`
> ([https://github.com/django/django/blob/6df19412aabb7d969f5eab4b2ff41269de89b233/django/db/models/lookups.py#L649
> source]):
> {{{#!py
> django.db.utils.ProgrammingError: the query has 2 placeholders but 3
> parameters were passed
> }}}
> 2. `__has_keys` or `__has_any_keys`:
> {{{#!py
>   File "/django/source/django/db/models/fields/json.py", line 278, in
> get_prep_lookup
> return [str(item) for item in self.rhs]
>   
> TypeError: 'Subquery' object is not iterable
> }}}
> 
> SQLite & MySQL:
> 1. `__range`: same as Postgres
> 2. `__has_keys` or `__has_any_keys`: same as Postgres
> 3. `__has_key`:
> {{{#!py
>   File "/django/source/django/db/models/fields/json.py", line 186, in
> compile_json_path_final_key
> return ".%s" % json.dumps(key_transform)
>^
> TypeError: Object of type Subquery is not JSON serializable
> }}}
> 4. `__gt`, `__gte`, `__lt`, `__lte`:
> {{{#!py
>   File "/django/source/django/db/models/fields/json.py", line 610, in
> process_rhs
> rhs_params = [json.loads(value) for value in rhs_params]
>   ^
> json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
> }}}
> 5. `__exact`:
> {{{#!py
> sqlite3.OperationalError: malformed JSON
> }}}
> 
> Additional failure on MySQL:
> 6. `__in`:
> {{{#!py
> django.db.utils.NotSupportedError: (1235, "This version of MySQL doesn't
> yet support 'LIMIT & IN/ALL/ANY/SOME subquery'")
> }}}
> 
> Oracle:
> 1. `__range`: same as others (database exception)
> 2. `__has_keys` or `__has_any_keys`: same as others
> 3. `__has_key`: same as SQLite & MySQL
> 4. Certain text lookups (`__icontains`, `__startswith`, `__istartswith`,
> `__endswith`, `__iendswith`): return wrong results, they appear to return
> any results having the key on the left-hand side regardless of the
> contents of the right-hand side, refer to the modifications commented out
> in the linked test.
> 
> This is all pretty niche, but if the context helps, I could envision
> realistic use cases for `__has_keys=queryset`, as I work on a project
> that uses stringified UUIDs identifying other entities as JSON keys.

New description:

 After #35972, I worked on a
 
[https://github.com/jacobtylerwalls/django/commit/3c56106e4c60639f274c4acbfb582f6d1251051b
 test] to verify support for `JSONField` lookups against right-hand side
 subqueries. Support is mostly complete on Postgres, but largely incomplete
 on other backends.

 I'm suggesting we close this ticket (in separate PRs) with a combination
 of adding support where possible (perhaps for `__range`?), with failing at
 the python layer with more appropriate exceptions, or possibly adding a
 feature flag to guard some failures. I agree with the
 [https://code.djangoproject.com/ticket/31779#comment:3 sentiment] that we
 cannot maintain endless feature flags for database quirks or insulate
 users from every bug in their database vendor, but