Forked from jhngrant/postgresql-debugger-install-ubuntu
Last active
May 21, 2021 09:51
-
-
Save rdrey/37bc41a2876b2be103768f5812d80048 to your computer and use it in GitHub Desktop.
Installing the PL/pgSQL Debugger Extension (pldbgapi) for pgAdmin III on PostgreSQL 9.4 and Ubuntu 14.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PostgreSQL can be on a remote server but you'll need root privileges in Linux and superuser in PostgreSQL. | |
# First install build tools | |
sudo su | |
# you can also use apt | |
aptitude install build-essential | |
aptitude install postgresql-server-dev-9.4 | |
aptitude install libkrb5-dev # I had a dependency on kerberos, you might not | |
# Clone and build the PL/pgSQL server-side debugger | |
cd /usr/local/src | |
git clone git://git.postgresql.org/git/pldebugger.git | |
cd pldebugger | |
export USE_PGXS=1 | |
make | |
make install | |
# Find location of postgresql.conf at the PostgreSQL console: | |
# SHOW config_file; | |
nano /etc/postgresql/9.4/main/postgresql.conf | |
# In nano use ^W to search for: shared_preload_libraries | |
# Edit the entry to add the library 'plugin_debugger': | |
shared_preload_libraries = 'plugin_debugger' | |
# If you have multiple libs, coma separate: | |
shared_preload_libraries = 'pg_stat_statements,plugin_debugger' | |
# Restart PostgreSQL | |
pg_ctlcluster --mode fast 9.4-main restart | |
# In a PostgreSQL database that you want to enable debugging install the extension | |
CREATE EXTENSION pldbgapi; | |
# In pgAdmin navigate to the same database and right click a PL/pgSQL function. | |
# In the context menu choose Debugging > Debug. | |
# A Debugger window will open and prompt for any parameters. | |
# It will then break on the first line of executable code. | |
# BRILLIANT! | |
# More info from the creators at: | |
# http://bit.ly/1Gaq51P | |
# http://git.postgresql.org/gitweb/?p=pldebugger.git;a=blob_plain;f=README.pldebugger;hb=HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good