Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion django/db/models/sql/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,12 @@ def apply_converters(self, rows, converters):
def has_composite_fields(self, expressions):
# Check for composite fields before calling the relatively costly
# composite_fields_to_tuples.
return any(isinstance(expression, ColPairs) for expression in expressions)
colpairs_type = ColPairs
# Use generator and return immediately upon finding the first match for performance
for expression in expressions:
if isinstance(expression, colpairs_type):
return True
return False

def composite_fields_to_tuples(self, rows, expressions):
col_pair_slices = [
Expand Down