#35833: Annotation yielding an empty set causes entire QuerySet to become empty
-------------------------------------+-------------------------------------
     Reporter:  Jacob Walls          |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  5.1
  (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 Jacob Walls):

 Thanks for the draft test. Looking again, it seems providing `NULL` to
 this function is fine, and doesn't raise an error:

 {{{
 % python manage.py dbshell
 psql (16.1, server 15.4)
 Type "help" for help.

 my_project=# SELECT JSONB_ARRAY_ELEMENTS(NULL);
  jsonb_array_elements
 ----------------------
 (0 rows)
 }}}

 So I guess my expectation is that I can use the annotation as written
 without interfering with my queryset as a whole. My use case was providing
 a path lookup that happened to not exist (returning NULL) rather than just
 querying the root of the field.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35833#comment:2>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701929064bbf0-8df90edf-4080-4017-8d34-043406fa4e9a-000000%40eu-central-1.amazonses.com.

Reply via email to