Deleting the Postgres service in XP

Installed Postgres 8.2, but the obsolete service for Postgres 8.1 hung around. Here’s how to manually get rid of it.

Ever since I installed Postgres 8.2, I’ve been still getting Postgres 8.1 listed in my pgAdmin tool — postgres runs as a service, and I was surprised that even after uninstalling, manually deleting dependent files and directories, and cleaning out the registry manually and with automated tools that the old service still persisted to run.

Here’s how to remove the service.

Right click the service and go to properties. Look at the Path to executable and find the service name:
“C:\Program Files\PostgreSQL\8.1\bin\pg_ctl.exe” runservice -N “pgsql-8.1” -D “C:\Program Files\PostgreSQL\8.1\data\”

Now Start / Run… cmd and enter this at the command prompt:
sc delete pgsql-8.1

You’ll get a “[SC] DeleteService SUCCESS” message as confirmation it’s gone.

0 thoughts on “Deleting the Postgres service in XP”

  1. I’m curious why C:Program FilesPostgreSQL8.1 was still on your hard drive after manually deleting files and directories.

    Or was that a reference to a directory you had already deleted yet somehow, somewhere it was running pg_ctl.exe with those parameters?

  2. The files themselves were not — the service, which was still in the service list as disabled, was pointing at that directory. Obviously, it had no way of starting up, but because it still appeared as “a service”, the admin tool was offering it as an option.

    One may also want to check the registry entry HKEY_CURRENT_USERSoftwarepgAdmin IIIServers and see if there are any extra settings with values of “PostgreSQL Database Server 8.1” and delete them.

    Also, HKEY_LOCAL_MACHINESOFTWAREPostgreSQLServicespgsql-8.1.

    And, HKEY_USERS{some guid}SoftwarepgAdmin IIIServers.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.