Commits

Anonymous committed 335ebb5

queryset-refactor: Don't use the "AS" keyword in the FROM-clause. Fixed #7055.
Patch from Ian Kelly.

This keyword is optional in SQL, but not permitted by Oracle. If we ever need
to support a backend that requires this keyword at some later date, we can make
it a connection.feature option, but that's overkill for now.

  • Participants
  • Parent commits 5869ddd
  • Branches queryset-refactor

Comments (0)

Files changed (2)

File django/db/models/sql/query.py

             if not self.alias_refcount[alias]:
                 continue
             name, alias, join_type, lhs, lhs_col, col, nullable = self.alias_map[alias]
-            alias_str = (alias != name and ' AS %s' % alias or '')
+            alias_str = (alias != name and ' %s' % alias or '')
             if join_type and not first:
                 result.append('%s %s%s ON (%s.%s = %s.%s)'
                         % (join_type, qn(name), alias_str, qn(lhs),

File django/db/models/sql/subqueries.py

     """
     def get_from_clause(self):
         result, params = self._query.as_sql()
-        return ['(%s) AS A1' % result], params
+        return ['(%s) A1' % result], params
 
     def get_ordering(self):
         return ()