On Fri, 2010-05-28 at 18:01 +0300, Peter Eisentraut wrote: > Yes, I would like to know who is connecting to what IP address. It's > useful if you have HA setups and you need to check which way your > connections are going.
A few comments on this patch: The two functions aren't perfectly symmetric, because pg_stat_get_backend_server_port() returns -1 if it's a unix socket, and pg_stat_get_backend_server_addr() returns NULL (which is also overloaded to mean that you don't have permissions). So, perhaps it's better to just have pg_stat_get_backend_server_addr(), which is the one you want, anyway. Also, for the permission check I'm inclined to throw an error rather than return NULL. If the function is being called from a view, it's understandable that we don't want to throw an error; but this function isn't being called from a view. Based on your use-case, I'm more worried about the HA system getting confused with a NULL result, and then failing mysteriously with no error message. Regards, Jeff Davis -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers