From 0c65ca99640b9f93843e76e32c8959ef749a282c Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Mon, 19 Jan 2026 21:45:42 +0200
Subject: [PATCH v10 5/5] Fix assertion failure from ProcKill in 'subscription'
 test

---
 src/backend/utils/init/postinit.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 37bee8d9f7b..ba41fab4ce5 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -1343,10 +1343,14 @@ ShutdownPostgres(int code, Datum arg)
 	/* Make sure we've killed any active transaction */
 	AbortOutOfAnyTransaction();
 
+	/* If waiting, get off wait queue (should only be needed after error) */
+	LockErrorCleanup();
+
 	/*
 	 * Session locks are not released by transaction end, so be sure to
 	 * release them explicitly.
 	 */
+	LockReleaseSession(DEFAULT_LOCKMETHOD);
 	LockReleaseSession(USER_LOCKMETHOD);
 }
 
-- 
2.47.3

