Dear Hoiguchi-san, Thank you for making the patch!
> It doesn't seem to work as expected. We still lose the relationship > between the PID file and the launched postmaster. Yes, I did not expect that the relationship can be kept. Conceptually +1 for your approach. > > Ditching cmd.exe seems like a big hassle. So, on the flip side, I > > tried to identify the postmaster PID using the shell's PID, and it > > seem to work. The APIs used are avaiable from XP/2003 onwards. According to 495ed0ef2, Windows 10 seems the minimal requirement for using the postgres. So the approach seems OK. Followings are my comment, but I can say only cosmetic ones because I do not have windows machine which can run postgres. 1. Forward declaration seems missing. In the pg_ctl.c, the static function seems to be declared even if there is only one caller (c.f., GetPrivilegesToDelete). 2. I think the argument should be pid_t. 3. I'm not sure the return type of the function should be pid_t or not. According to the document, DWORD corrresponds to the pid_t. In win32_port.h, the pid_t is defiend as int (_MSC_VER seems to be defined when the VisualStduio is used). It is harmless, but I perfer to match the interface between caller/callee. IIUC we can add just a cast. ``` #ifdef _MSC_VER typedef int pid_t; #endif ``` Best Regards, Hayato Kuroda FUJITSU LIMITED