diff options
| author | Adam Johnson <me@adamj.eu> | 2024-03-13 18:10:54 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-03-15 06:58:14 +0100 |
| commit | cbf1e87398a58737e27e1b680283903caf661f90 (patch) | |
| tree | 59cdd948fb7d18fe52bf74e59278d63208e22e4f /django/db/models/sql | |
| parent | 593067a8ee43e2167c5ffc92e3cc3c5e40ec4aa4 (diff) | |
Fixed #35294 -- Fixed TEXT format of QuerySet.explain() for long plans.
co-authored-by: Gordon <gordon.wrigley@gmail.com>
co-authored-by: Simon Charette <charette.s@gmail.com>
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/compiler.py | 11 |
1 files changed, 6 insertions, 5 deletions
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): |
