For those who seek help in different areas of software and hardware platform.

How To Install Debugger for PostgreSQL on Ubuntu 18/19/20.04

The debugger may be used to debug PL/pgSQL functions in PostgreSQL, as well as EDB-SPL functions, stored procedures and packages in EDB Postgres Advanced Server. The Debugger is available as an extension for your PostgreSQL installation. This guide assumes that you have already set up PostgreSQL on your Ubuntu.


Install Prerequisites

sudo apt install build-essential
sudo apt install postgresql-server-dev-12
sudo apt install openssl
sudo apt install krb5-multidev
sudo apt install libkrb5-dev
sudo apt install libssl-dev


Clone Debugger

cd /usr/local/src
sudo git clone


Install Debugger

cd pldebugger
export USE_PGXS=1
You will need to set appropriate permission on the following directories:
sudo chown -R your_username:your_username /usr/lib/postgresql
sudo chown -R your_username:your_username /usr/share/postgresql
sudo chown -R your_username:your_username /usr/share/doc/postgresql-doc-12
make install
Now revert the permission back to root:
sudo chown -R root:root /usr/lib/postgresql
sudo chown -R root:root /usr/share/postgresql
sudo chown -R root:root /usr/share/doc/postgresql-doc-12
Next, edit postgresql.conf file with any of your favorite text editor:
sudo nano /etc/postgresql/12/main/postgresql.conf
Find the following line, uncomment and add plugin_debugger like below:
shared_preload_libraries = 'plugin_debugger'
Save and close the file. Restart PostgreSQL to take changes into effect:
sudo pg_ctlcluster --mod fast 12 main restart
sudo systemctl restart postgresql
sudo systemctl status postgresql
Next, connect to a PostgreSQL database that you want to enable debugging install the extension:
psql -h localhost -U postgres


You now have successfully installed debugger for your PostgreSQL database on Ubuntu 18/19/20.04.

1 comment:

  1. Thank you very much, excellent guide.

    Just add two things, in Ubuntu 20.04 it is required to install clang-10:

    $ sudo apt install clang-10

    And the directory "/usr/share/doc/postgresql-doc-12" does not exist, it must be created:

    $ sudo mkdir /usr/share/doc/postgresql-doc-12


Comments with links will not be published.

Video Tutorials