Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

queryset-refactor: Don't use the "AS" keyword in the FROM-clause. Fix…

…ed #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.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7439 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 88488e5aa570f4ee552a2ce1399bd27f115b4546 1 parent c43a3d7
Malcolm Tredinnick authored April 22, 2008
2  django/db/models/sql/query.py
@@ -420,7 +420,7 @@ def get_from_clause(self):
420 420
             if not self.alias_refcount[alias]:
421 421
                 continue
422 422
             name, alias, join_type, lhs, lhs_col, col, nullable = self.alias_map[alias]
423  
-            alias_str = (alias != name and ' AS %s' % alias or '')
  423
+            alias_str = (alias != name and ' %s' % alias or '')
424 424
             if join_type and not first:
425 425
                 result.append('%s %s%s ON (%s.%s = %s.%s)'
426 426
                         % (join_type, qn(name), alias_str, qn(lhs),
2  django/db/models/sql/subqueries.py
@@ -361,7 +361,7 @@ class CountQuery(Query):
361 361
     """
362 362
     def get_from_clause(self):
363 363
         result, params = self._query.as_sql()
364  
-        return ['(%s) AS A1' % result], params
  364
+        return ['(%s) A1' % result], params
365 365
 
366 366
     def get_ordering(self):
367 367
         return ()

0 notes on commit 88488e5

Please sign in to comment.
Something went wrong with that request. Please try again.