How to enable debug mode in PostgreSQL?
PgAdmin comes with built-in support to debug your Pl/PgSQL codes. However, in order to enable this, you need to compile and install a separate plug-in for PostgreSQL
Now, once you have set up a proper environment for debugging, go to edit
/etc/postgresql/9.4/main/postgresql.conf and enable the debugger plugin.