-
-
Save jhngrant/c1787346fcb4b0e3001a to your computer and use it in GitHub Desktop.
# 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 | |
aptitude install build-essential | |
aptitude install postgresql-server-dev-9.4 | |
# 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 |
I managed to compile the debugger for PostgreSQL 12 on Ubuntu server 18.04. However with the plugin_debugger.so
referenced in the postgresql.conf
's shared_preload_libraries
, PostgresSQL failed to start with the following issue: 2019-12-25 08:44:31.610 MST [21578] FATAL: could not load library "/usr/lib/postgresql/12/lib/plugin_debugger.so": /usr/lib/postgresql/12/lib/plugin_debugger.so: undefined symbol: PostmasterIsAlive
Any pointer is greatly appreciated.
I am getting the exact same error after I upgraded to PostgreSQL 12 also on Ubuntu 18.04.
@granteckels I use postgresql-12 and ubuntu 18.04 and I installed this version postgresql-12-pldebugger which is compatible, that would only be for the installation steps the other steps and configuration are the same
when making, is there a way to specify which postgresql-server-dev version to use? On my system I have all of them, up until 10, but I specifically want to compile for 9.6