Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> My point is that we shouldn't be putting checks into DDL commands about
> single-user mode if the actual cause of the issue is in a lower-level
> system. Not all uses of a particular DDL command necessary use a latch,
> for example. Also, there could be other things that hit a latch that
> are reachable in single-user mode that we haven't found yet.
> So I think the check should either go somewhere in the latch code, or
> possibly in the libpqwalreceiver code. Or we make the latch code work
> so that the check-for-postmaster-death code becomes a noop in
> single-user mode. Suggestions?
It's certainly plausible that we could have the latch code just ignore
WL_POSTMASTER_DEATH if not IsUnderPostmaster. I think that the original
reasoning for not doing that was that the calling code should know which
environment it's in, and not pass an unimplementable wait-exit reason;
so silently ignoring the bit could mask a bug. Perhaps that argument is
no longer attractive. Alternatively, we could fix the relevant call sites
to do "(IsUnderPostmaster ? WL_POSTMASTER_DEATH : 0)", and keep the strict
behavior for the majority of call sites.
regards, tom lane