markwkm/pg_top

pg_top attempting to connect to wrong socket file

Closed this issue · 1 comments

Ever since upgrading our database from 9.5 to 11, pg_top has stopped connecting. It is apparently looking for the socket file in /tmp instead of /var/run/postgresql/.

I know this is not a pg_top problem. I ran a custom built pg_top binary on my build machine (postgres is not installed there) and it errored out looking for the socket file in /var/run/postgresql/. That gave me hope, but when I copied that binary to my db machine it still is looking for /tmp/.

That is how I determined this is environmental. However, I have no idea what controls this behavior. Is it a config file somewhere? Environment variable? I tried looking through the source, but the only thing I see is a call to PQsocket(). Maybe this is question for libpq people?

And nvm. Setting PGHOST=/var/run/postgresql fixes it.