pgsql: Fix registering shmem callbacks in single-user mode

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix registering shmem callbacks in single-user mode
Date: 2026-08-26 10:01:07
Message-ID: E1wzARO-00000002BGR-1ZlK@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix registering shmem callbacks in single-user mode

RegisterShmemCallbacks() should not be called from the postmaster
process after postmaster startup. Add an assertion for that, and fix
the check for whether it's being called for "after startup"
allocations to take single-user mode into account.

Author: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/CAJTYsWU7epjUL1-xrpYeOrmkmq20M2Q22Y_SRb8PWQG8KNQyDw@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b259ece92a951e799d8ace7a865d6269cc1cdd71

Modified Files
--------------
src/backend/storage/ipc/shmem.c | 10 ++++++++--
.../modules/test_shmem/t/001_late_shmem_alloc.pl | 22 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2026-08-26 14:41:10 pgsql: Close relations opened specifically for AFTER triggers
Previous Message Amit Kapila 2026-08-26 09:24:04 pgsql: Skip relations dropped concurrently in GetSubscriptionRelations(