diff options
| author | François Freitag <mail@franek.fr> | 2017-05-05 19:19:34 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-05-06 06:59:04 -0400 |
| commit | 88336fdbb5e101fa25825b737169c0d6af2faa93 (patch) | |
| tree | 208e2b3cb2a8aa8cdc9f0614abb03228b8b6fb84 /django | |
| parent | 504e7782fef74cb78768092780a3476866379c21 (diff) | |
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.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/query.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index 1cc5217d0e..ae0b44cf2a 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -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): """ |
