Index: django/db/models/sql/compiler.py
===================================================================
--- django/db/models/sql/compiler.py	(revision 16591)
+++ django/db/models/sql/compiler.py	(working copy)
@@ -696,7 +696,7 @@
         # are released.
         if self.query.select_for_update and transaction.is_managed(self.using):
             transaction.set_dirty(self.using)
-        for rows in self.execute_sql(MULTI):
+        for rows in self.execute_sql(MULTI, True):
             for row in rows:
                 if resolve_columns:
                     if fields is None:
@@ -727,7 +727,7 @@
 
                 yield row
 
-    def execute_sql(self, result_type=MULTI):
+    def execute_sql(self, result_type=MULTI, iterating=False):
         """
         Run the query against the database and returns the result(s). The
         return value is a single data item if result_type is SINGLE, or an
@@ -750,7 +750,7 @@
             else:
                 return
 
-        cursor = self.connection.cursor()
+        cursor = self.connection.cursor(iterating)
         cursor.execute(sql, params)
 
         if not result_type:
Index: django/db/backends/sqlite3/base.py
===================================================================
--- django/db/backends/sqlite3/base.py	(revision 16591)
+++ django/db/backends/sqlite3/base.py	(working copy)
@@ -186,7 +186,7 @@
         self.introspection = DatabaseIntrospection(self)
         self.validation = BaseDatabaseValidation(self)
 
-    def _cursor(self):
+    def _cursor(self, iterating=False):
         if self.connection is None:
             settings_dict = self.settings_dict
             if not settings_dict['NAME']:
Index: django/db/backends/mysql/base.py
===================================================================
--- django/db/backends/mysql/base.py	(revision 16591)
+++ django/db/backends/mysql/base.py	(working copy)
@@ -303,7 +303,7 @@
                 self.connection = None
         return False
 
-    def _cursor(self):
+    def _cursor(self, iterating=False):
         if not self._valid_connection():
             kwargs = {
                 'conv': django_conversions,
@@ -331,8 +331,11 @@
             self.connection.encoders[SafeUnicode] = self.connection.encoders[unicode]
             self.connection.encoders[SafeString] = self.connection.encoders[str]
             connection_created.send(sender=self.__class__, connection=self)
-        cursor = CursorWrapper(self.connection.cursor())
-        return cursor
+        if iterating:
+            cursor = self.connection.cursor(cursorclass=Database.cursors.SSCursor)
+        else:
+            cursor = self.connection.cursor()
+        return CursorWrapper(cursor)
 
     def _rollback(self):
         try:
Index: django/db/backends/oracle/base.py
===================================================================
--- django/db/backends/oracle/base.py	(revision 16591)
+++ django/db/backends/oracle/base.py	(working copy)
@@ -452,7 +452,7 @@
         return "%s/%s@%s" % (settings_dict['USER'],
                              settings_dict['PASSWORD'], dsn)
 
-    def _cursor(self):
+    def _cursor(self, iterating=False):
         cursor = None
         if not self._valid_connection():
             conn_string = convert_unicode(self._connect_string())
Index: django/db/backends/__init__.py
===================================================================
--- django/db/backends/__init__.py	(revision 16591)
+++ django/db/backends/__init__.py	(working copy)
@@ -273,12 +273,12 @@
             self.connection.close()
             self.connection = None
 
-    def cursor(self):
+    def cursor(self, iterating=False):
         if (self.use_debug_cursor or
             (self.use_debug_cursor is None and settings.DEBUG)):
-            cursor = self.make_debug_cursor(self._cursor())
+            cursor = self.make_debug_cursor(self._cursor(iterating))
         else:
-            cursor = util.CursorWrapper(self._cursor(), self)
+            cursor = util.CursorWrapper(self._cursor(iterating), self)
         return cursor
 
     def make_debug_cursor(self, cursor):
Index: django/db/backends/postgresql_psycopg2/base.py
===================================================================
--- django/db/backends/postgresql_psycopg2/base.py	(revision 16591)
+++ django/db/backends/postgresql_psycopg2/base.py	(working copy)
@@ -105,14 +105,17 @@
         self.introspection = DatabaseIntrospection(self)
         self.validation = BaseDatabaseValidation(self)
         self._pg_version = None
+        self._cursor_prefix = 'namedcursor'
+        self._cursor_counter = 0
 
     def check_constraints(self, table_names=None):
         """
         To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they
         are returned to deferred.
         """
-        self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE')
-        self.cursor().execute('SET CONSTRAINTS ALL DEFERRED')
+        cursor = self.cursor()
+        cursor.execute('SET CONSTRAINTS ALL IMMEDIATE')
+        cursor.execute('SET CONSTRAINTS ALL DEFERRED')
 
     def _get_pg_version(self):
         if self._pg_version is None:
@@ -120,12 +123,14 @@
         return self._pg_version
     pg_version = property(_get_pg_version)
 
-    def _cursor(self):
-        new_connection = False
+    def _generate_cursor_name(self):
+        self._cursor_counter += 1
+        return '%s-%d' % (self._cursor_prefix, self._cursor_counter)
+
+    def _cursor(self, iterating=False):
         set_tz = False
         settings_dict = self.settings_dict
         if self.connection is None:
-            new_connection = True
             set_tz = settings_dict.get('TIME_ZONE')
             if settings_dict['NAME'] == '':
                 from django.core.exceptions import ImproperlyConfigured
@@ -148,12 +153,16 @@
             self.connection.set_client_encoding('UTF8')
             self.connection.set_isolation_level(self.isolation_level)
             connection_created.send(sender=self.__class__, connection=self)
-        cursor = self.connection.cursor()
-        cursor.tzinfo_factory = None
-        if new_connection:
             if set_tz:
-                cursor.execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']])
+                # use a throwaway cursor for this SET; if we are creating a
+                # named cursor later this would cause problems otherwise
+                self.connection.cursor().execute("SET TIME ZONE %s", [settings_dict['TIME_ZONE']])
             self._get_pg_version()
+        if iterating:
+            cursor = self.connection.cursor(name=self._generate_cursor_name())
+        else:
+            cursor = self.connection.cursor()
+        cursor.tzinfo_factory = None
         return CursorWrapper(cursor)
 
     def _enter_transaction_management(self, managed):
