Scott Ribe <scott_ribe@elevated-dev.com> writes:
>> On Aug 10, 2022, at 3:08 PM, richard coleman <rcoleman.ascentgl@gmail.com> wrote:
>> Apparently, I've discovered that PostgreSQL connects to itself over UDP.
> No it doesn't. (It can use Unix domain sockets for local connections.)
Possibly Richard is seeing the stats collector pipe, which is TCP local
loopback on a random port number. (That'll be gone in v15, but it
exists in all current releases.)
> I've also discovered, while looking at the network while one of our server was running PostgreSQL, that while there
werea number of connections between local 5432 and a random remote port, there was also a connection from a local
randomport to a remote 5432. If these ports were closed and only 5432 left open, this connection would have failed.
postgres_fdw outgoing connection to a remote server? Maybe it's something
else, but that's the most obvious theory.
The incoming-connection port and the stats loopback are the only
IP connections in a bare-bones Postgres system, but I think few
people run it completely bare-bones. There's no such thing as
a "definitive list" of ports used as long as you've told us
nothing about (for example) your backup or replication setup,
not to mention postgres_fdw and other extensions you might use.
regards, tom lane