summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2023-05-31 00:03:46 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-06-14 08:20:39 +0200
commitcfc9c94d97edf9aaea647bbecc89a791cf7ec0b8 (patch)
tree83ec844daf6842dee21d999b0a1da0712fbfec0d /django/db/models/sql
parent0cfcab4eec6a9ebdd1306d3c4c4c6b7bcfcd23f1 (diff)
Refs #32143 -- Adjusted a comment about subquery usage in Query.split_exclude().
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/query.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 772ba13419..12066cd4f8 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -2035,11 +2035,10 @@ class Query(BaseExpression):
)
condition.add(or_null_condition, OR)
# Note that the end result will be:
- # (outercol NOT IN innerq AND outercol IS NOT NULL) OR outercol IS NULL.
- # This might look crazy but due to how IN works, this seems to be
- # correct. If the IS NOT NULL check is removed then outercol NOT
- # IN will return UNKNOWN. If the IS NULL check is removed, then if
- # outercol IS NULL we will not match the row.
+ # NOT EXISTS (inner_q) OR outercol IS NULL
+ # this might look crazy but due to how NULL works, this seems to be
+ # correct. If the IS NULL check is removed, then if outercol
+ # IS NULL we will not match the row.
return condition, needed_inner
def set_empty(self):