How to uninstall PostgreSQL 17 on Windows
Make and verify a database backup before uninstalling PostgreSQL 17. Do not rely on an uninstaller message to preserve the data directory.
This covers PostgreSQL 17.11-5 installed for the machine with winget. The installer's own defaults were used. No extra database was created and nobody signed in to pgAdmin.
Quit pgAdmin and stop the postgresql-x64-17 service first. This run had pgAdmin4.exe, python.exe and pg_ctl.exe.
The uninstall page defaults to Entire application. The observed data directory was %ProgramFiles%\PostgreSQL\17\data. Back it up first, and leave the whole program directory unselected in Mole if it still contains a database you want to keep.
& "${env:ProgramFiles}\PostgreSQL\17\uninstall-postgresql.exe"
Where the data is
| Location | What it holds | What to do |
|---|---|---|
%ProgramFiles%\PostgreSQL\17 |
The program and data |
Entire application was left selected. Both the program and data were gone |
%ProgramFiles%\PostgreSQL |
An empty parent folder | Still there. Remove it only after checking it does not hold another version |
%APPDATA%\pgAdmin and %APPDATA%\pgadmin4 |
pgAdmin sessions and cache | Still there. A standalone pgAdmin uses the same two folders |
HKLM\SOFTWARE\PostgreSQL |
Install and service registration | Still there |
The uninstaller warns that the data directory was not removed. After Entire application, a later read showed 17\data was already gone.
Check
Test-Path "${env:ProgramFiles}\PostgreSQL\17"
Get-Service 'postgresql-x64-17' -ErrorAction SilentlyContinue
Falseon the first path means the version 17 program folder is gone.- No output alone does not prove the service is absent; a suppressed access or query error leaves that unknown.
Mole listed the program folder, the Start Menu entry and a usage record. It did not list the two pgAdmin profile folders.
What Mole lists
| Location | Item | Default |
|---|---|---|
%ProgramFiles%\PostgreSQL\17 |
Program files | Goes with the app row |
%ProgramData%\Microsoft\Windows\Start Menu\Programs\PostgreSQL 17 |
Shortcut | Selected by default |
%ProgramFiles%\PostgreSQL\17 |
Usage records for this program | Selected by default |
The wizard used Entire application and warned that data was not removed, but the Mole-assisted run subsequently removed the version directory including data. A separate vendor-only run left that directory and data. The postgresql-x64-17 service disappeared. The pgAdmin data at %APPDATA%\pgAdmin and %APPDATA%\pgadmin4 was not listed; standalone pgAdmin can share it.
These defaults assume Remove data and settings with apps is off. Explicit Select all or Also remove user data can include the listed personal-data rows. Check the selection before confirming. Selected files that Mole removes go to the Recycle Bin; selected registry entries are backed up before removal. The vendor uninstaller has its own deletion behavior.
What this test covered
Recorded on 2026-10-20: PostgreSQL 17, version 17.11-5, machine-wide, vendor uninstaller, winget package PostgreSQL.PostgreSQL.17. The evidence comes from an ARM64 Windows test environment and a development build of Mole. It does not certify the current downloadable package or removal of real signed-in accounts, synchronized data or production projects.
Vendor documentation. The paths and removal results above are observations from the Windows test unless explicitly attributed to the vendor.
