summaryrefslogtreecommitdiff
path: root/django/db/models/sql/datastructures.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2022-11-06 11:19:33 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-11-07 20:23:53 +0100
commit76e37513e22f4d9a01c7f15eee36fe44388e6670 (patch)
tree575decec7547c3c128857b0444f342452865a0f9 /django/db/models/sql/datastructures.py
parent4b702c832cd550fe682ef37a69e93866815b9123 (diff)
Refs #33374 -- Adjusted full match condition handling.
Adjusting WhereNode.as_sql() to raise an exception when encoutering a full match just like with empty matches ensures that all case are explicitly handled.
Diffstat (limited to 'django/db/models/sql/datastructures.py')
-rw-r--r--django/db/models/sql/datastructures.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/db/models/sql/datastructures.py b/django/db/models/sql/datastructures.py
index 1edf040e82..069eb1a301 100644
--- a/django/db/models/sql/datastructures.py
+++ b/django/db/models/sql/datastructures.py
@@ -2,6 +2,7 @@
Useful auxiliary data structures for query construction. Not useful outside
the SQL domain.
"""
+from django.core.exceptions import FullResultSet
from django.db.models.sql.constants import INNER, LOUTER
@@ -100,8 +101,11 @@ class Join:
join_conditions.append("(%s)" % extra_sql)
params.extend(extra_params)
if self.filtered_relation:
- extra_sql, extra_params = compiler.compile(self.filtered_relation)
- if extra_sql:
+ try:
+ extra_sql, extra_params = compiler.compile(self.filtered_relation)
+ except FullResultSet:
+ pass
+ else:
join_conditions.append("(%s)" % extra_sql)
params.extend(extra_params)
if not join_conditions: