How to uninstall the postgresql

The simplest way to do this is open a terminal and type:

sudo apt-get --purge remove postgresql

This will remove the postgresql package. There may be chances that additional packages are also installed so you can search them by typing:

dpkg -l | grep postgres

and purge all those packages by sudo apt-get --purge remove {package name}.