1
0
mirror of https://github.com/django/django.git synced 2025-10-29 08:36:09 +00:00

Fixed #28062 -- Added a setting to disable server-side cursors on PostgreSQL.

When a connection pooler is set up in transaction pooling mode, queries
relying on server-side cursors fail. The DISABLE_SERVER_SIDE_CURSORS
setting in DATABASES disables server-side cursors for this use case.
This commit is contained in:
François Freitag
2017-05-05 19:19:34 -07:00
committed by Tim Graham
parent 504e7782fe
commit 88336fdbb5
7 changed files with 98 additions and 2 deletions

View File

@@ -306,7 +306,8 @@ class QuerySet:
An iterator over the results from applying this QuerySet to the
database.
"""
return iter(self._iterable_class(self, chunked_fetch=True))
use_chunked_fetch = not connections[self.db].settings_dict.get('DISABLE_SERVER_SIDE_CURSORS')
return iter(self._iterable_class(self, chunked_fetch=use_chunked_fetch))
def aggregate(self, *args, **kwargs):
"""