I'm trying to trace the source of postgres queries identified by a pid. Normally you can do this by finding the client_addr and client_port fields in the pg_stat_activity table.
However, some entries have client_port -1 or NULL. What does this mean and how can one go about finding the source of these queries?
I think NULL ports indicated that this is an internal postgres operation, and I suspected that -1 meant local connections - but I couldn't work out how local connections communicated with the postgres daemon.