From 76e37513e22f4d9a01c7f15eee36fe44388e6670 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sun, 6 Nov 2022 11:19:33 -0500 Subject: 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. --- django/db/models/sql/datastructures.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'django/db/models/sql/datastructures.py') 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: -- cgit v1.3