v8-0002-Don-t-hint-that-you-can-reconnect-when-the-databa.patch
text/x-patch
Filename: v8-0002-Don-t-hint-that-you-can-reconnect-when-the-databa.patch
Type: text/x-patch
Part: 1
Message:
Re: Interrupts vs signals
Patch
Format: format-patch
Series: patch v8-0002
Subject: Don't hint that you can reconnect when the database is dropped
| File | + | − |
|---|---|---|
| src/backend/tcop/postgres.c | 13 | 11 |
From 202c07dae041d465e4de71e369940b09b0a2f380 Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Thu, 22 Jan 2026 19:17:30 +0200
Subject: [PATCH v8 2/8] Don't hint that you can reconnect when the database is
dropped
---
src/backend/tcop/postgres.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 29becf0a703..980ef1da100 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3209,27 +3209,29 @@ ProcessRecoveryConflictInterrupt(ProcSignalReason reason)
}
}
- /* Intentional fall through to session cancel */
- /* FALLTHROUGH */
-
- case PROCSIG_RECOVERY_CONFLICT_DATABASE:
-
/*
- * Retrying is not possible because the database is dropped, or we
- * decided above that we couldn't resolve the conflict with an
- * ERROR and fell through. Terminate the session.
+ * The conflict cannot be resolved with ERROR, so terminate the
+ * whole session.
*/
pgstat_report_recovery_conflict(reason);
ereport(FATAL,
- (errcode(reason == PROCSIG_RECOVERY_CONFLICT_DATABASE ?
- ERRCODE_DATABASE_DROPPED :
- ERRCODE_T_R_SERIALIZATION_FAILURE),
+ (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
errmsg("terminating connection due to conflict with recovery"),
errdetail_recovery_conflict(reason),
errhint("In a moment you should be able to reconnect to the"
" database and repeat your command.")));
break;
+ case PROCSIG_RECOVERY_CONFLICT_DATABASE:
+
+ /* The database is being dropped; terminate the session */
+ pgstat_report_recovery_conflict(reason);
+ ereport(FATAL,
+ (errcode(ERRCODE_DATABASE_DROPPED),
+ errmsg("terminating connection due to conflict with recovery"),
+ errdetail_recovery_conflict(reason)));
+ break;
+
default:
elog(FATAL, "unrecognized conflict mode: %d", (int) reason);
}
--
2.47.3