port of the local connection
postgres=# -- port of the local connection postgres=# select inet_server_port(); inet_server_port ------------------ 5432 (1 row) postgres=#