pg_ctl is a control utility on top of the postgres binary allowing to do many operations on a server. A couple of its subcommands offer a way to wait for the operation to finish before exiting pg_ctl, which is useful to ensure the state of the server before moving on with other things in the upper application layer. Sub-commands start, restart and register (Windows-only to register Postgres as a service in the in-core SCM), are not waited to finish by default, but this can be done by using the -w switch. Reversely, the sub-command stop implies to wait, and this can be disabled by using the switch -W. In Postgres 10, the sub-command promote has gained this option, per the following commit:
Read more...