Query is executing without starting the PostgreSQL 9.6 Windows Service
PostgreSQL can be started using different methods. 

You (or most probably some tool) are likely to have started PostgreSQL by using:

pg_ctl start -D /path/to/data 


(Assuming pg_ctl.exe is in one directory in your PATH)

Note that this doesn't start PostgreSQL as a Windows Service; but it starts PostgreSQL anyhow (if all parameters and settings are correct).

Depending on which installer you used and which settings you chose, the installer created also a Windows Service that should start when your system starts. Normally, when you use this installation method, it also starts the service.

If you can restart your machine, it most probably will start the PostgreSQL service in the normal fashion. If it doesn't, it is probable that some other of your services is starting PostgreSQL behind the scenes. 

We can probably be more precise if you let us know which installer you used (EnterpriseDB PostgreSQL installer tends to be the most commonly used for Windows).



References


pg_ctl
PostgreSQL Windows Installers