2

I am able to uninstall postgresql from Ubuntu. But I cannot seem remove the client - psql.

I've tried the steps listed here: How to remove Postgres from my installation?. But it still doesn't work

Zach Smith
  • 155
  • 2
  • 9

1 Answers1

3

the command you are looking for is :

sudo apt purge postgresql-client-common

purge is different from remove as it will also remove the dependencies that only this app uses.

tatsu
  • 3,008
  • 3
  • 40
  • 71
  • Thank you. what does this purge command do that uninstall doesn't? – Zach Smith Jul 16 '19 at 13:50
  • `psql*` is not the proper string to purge on. – Thomas Ward Jul 16 '19 at 14:05
  • but if I put the exact package then you don't need `purge` either. purge can be really handy when you are in a scenario where don't want any of the app left on your system and you don't know what package name you are looking for. in this case it worked for him, I assume, because `postgresql-client-common` was one of the dependencies pulled when installing `psql`. – tatsu Jul 16 '19 at 14:45
  • I've been looking for this for years! I had a postgres installation on my macbook that was interfering with a docker container running postgres on the default port 5432, and I never figured out how to remove the local postgres install, so in that fleet of containers I had to use a `docker-compose.override.yml` file to remap the ports to avoid the conflict... a similar problem just came up (but not the same - I wanted to remove pg latest and install an earlier version for some testing), and I found this - thank you! – drkvogel Feb 25 '22 at 14:39
  • What I wonder, though, is why is it not obvious how to uninstall pg, why is this command not on the pg website (AFAIK), why does `apt-get --purge remove postgresql` not work, and why are there only 3 upvotes for this answer?? – drkvogel Feb 25 '22 at 14:41