Skip to content

postgresql tools

help with some postgresql tools

installing adminpack on ubuntu

if you use pgadmin iii, maybe you have seen some "missing server instrumentation" error. if you use postgresql 8.3 with ubuntu 8.10, you can run the following:

sudo apt-get install -y postgresql-contrib
psql -U postgres -d postgres -h localhost < /usr/share/postgresql/8.3/contrib/adminpack.sql

fix psycopg2 errors on pg_activity

if you find some errors on psycopg2 while running pg_activity:

pg_activity -U postgres

Traceback (most recent call last):
  File "/bin/pg_activity", line 11, in <module>
    load_entry_point('pg-activity==2.2.1', 'console_scripts', 'pg_activity')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/", line 2700, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/", line 2318, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.6/site-packages/pgactivity/", line 8, in <module>
    from psycopg2.errors import OperationalError
  File "/usr/lib64/python3.6/site-packages/psycopg2/", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: /usr/lib64/python3.6/site-packages/psycopg2/ undefined symbol: PQencryptPasswordConn

maybe these commands can solve the problem for you.

pip3 uninstall psycopg2
pip install --upgrade pip
pip3 install psycopg2-binary