From 71da2b4f11938532df63817f8ea01e30c0875a05 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 6 Oct 2017 18:47:41 +0200 Subject: [PATCH] [2.0.x] Refs #24254 -- Removed unnecessary SQL AS clause in SQLCompiler.as_sql(). Incorrect on Oracle. Backport of 11ade8eefd32f5bc7ee6379b77824f02ca61c20b from master --- django/db/models/sql/compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 14d44d3eef..ac2efc4499 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -564,7 +564,7 @@ class SQLCompiler: subselect, subparams = select_clone.as_sql(self, self.connection) sub_selects.append(subselect) sub_params.extend(subparams) - return 'SELECT %s FROM (%s) AS subquery' % ( + return 'SELECT %s FROM (%s) subquery' % ( ', '.join(sub_selects), ' '.join(result), ), sub_params + params