> AFAIC Windows has no way to disassociate a process with a console window in a similar way.
Can this be a solution for this issue to add an option CREATE_NEW_PROCESS_GROUP to CreateProcess() function into pg_ctl.exe to start postgres.exe process?
That definitely sounds like it should be worth a try.
> I will say though that most people run the postmaster as a background service on Windows, rather than launching it manually.
Unfortunately, we also met this issue, with poor reproducibility, when we running the postmaster as Windows Service.
Maybe this is another story than launching it manually by pg_ctl.exe.
I will update you if I get any new information.
That sounds very strange. I'm not saying you're not running into an issue there, but my guess would be you're actually running into a different problem (which may have similar symptoms).