From cbf1e87398a58737e27e1b680283903caf661f90 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 13 Mar 2024 18:10:54 +0000 Subject: Fixed #35294 -- Fixed TEXT format of QuerySet.explain() for long plans. co-authored-by: Gordon co-authored-by: Simon Charette --- django/db/models/sql/compiler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'django/db/models/sql/compiler.py') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index b36125c762..676625df6f 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1621,11 +1621,12 @@ class SQLCompiler: # tuples with integers and strings. Flatten them out into strings. format_ = self.query.explain_info.format output_formatter = json.dumps if format_ and format_.lower() == "json" else str - for row in result[0]: - if not isinstance(row, str): - yield " ".join(output_formatter(c) for c in row) - else: - yield row + for row in result: + for value in row: + if not isinstance(value, str): + yield " ".join([output_formatter(c) for c in value]) + else: + yield value class SQLInsertCompiler(SQLCompiler): -- cgit v1.3