Re: shmem_startup_hook called twice on Windows - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: shmem_startup_hook called twice on Windows
Date
Msg-id aJ9XfH74VNqOt_jb@nathan
Whole thread Raw
In response to Re: shmem_startup_hook called twice on Windows  (Sami Imseih <samimseih@gmail.com>)
Responses Re: shmem_startup_hook called twice on Windows
List pgsql-hackers
On Fri, Aug 15, 2025 at 10:36:47AM -0500, Sami Imseih wrote:
> But that could potentially be dangerous if code in the startup hook gets
> re-executed?  I guess the doc below is giving a vague warning that one
> should be careful what they put in that hook.

The docs seem reasonably clear that these hooks need to be careful to not
re-initialize shared memory that was already initialized by another backend
[0].

> Thanks, I missed the doc update. Yes, that is inconsistent between platforms,
> and if we must live with this behavior, should the doc give a bigger warning
> about the code that goes in that hook?

The docs should definitely be updated for accuracy, but I'm not following
what sort of additional warning you think we need.  Could you share a
concrete example of what you have in mind?

[0] https://www.postgresql.org/docs/devel/xfunc-c.html#XFUNC-SHARED-ADDIN

-- 
nathan



pgsql-hackers by date:

Previous
From: Greg Burd
Date:
Subject: [PATCH] Add tests for Bitmapset
Next
From: Kirk Wolak
Date:
Subject: PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables)