summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/base.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2021-10-01 07:23:57 +0200
committerGitHub <noreply@github.com>2021-10-01 07:23:57 +0200
commit98c8bf1ceeab5c68751c83555f82cff1a9120a67 (patch)
tree45084610ab4d18818dafd77a0935772481cb41cb /django/db/backends/postgresql/base.py
parent492ed60f236d770eb9a6d56d85ff2550bb1ecfff (diff)
Fixed #33160 -- Avoided suppressing query errors in _nodb_cursor() on PostgreSQL.
Diffstat (limited to 'django/db/backends/postgresql/base.py')
-rw-r--r--django/db/backends/postgresql/base.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index ad8d85da29..8864a4f543 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -304,10 +304,13 @@ class DatabaseWrapper(BaseDatabaseWrapper):
@contextmanager
def _nodb_cursor(self):
+ cursor = None
try:
with super()._nodb_cursor() as cursor:
yield cursor
except (Database.DatabaseError, WrappedDatabaseError):
+ if cursor is not None:
+ raise
warnings.warn(
"Normally Django will use a connection to the 'postgres' database "
"to avoid running initialization queries against the production "