Re: Adding a pg_servername() function
Christoph Moench-Tegeder <cmt@burggraben.net>
From: Christoph Moench-Tegeder <cmt@burggraben.net>
To: GF <phabriz@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>, Laetitia Avrot <laetitia.avrot@gmail.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-09T20:05:21Z
Lists: pgsql-hackers
## GF (phabriz@gmail.com): > In the past I needed such a pg_servername() function because in a project I > was engaged on they needed to distribute "requests" directed to a in-house > management service running on network servers, and each one had a DB, so we > went with pglogical to be used as a (transactional) messaging middleware. That sounds like an "if all you have is a hammer" kind of architecture. Or "solutioning by fandom". Short of using an actual addressable message bus, you could set up the node name as a configuration parameter, or use cluster_name, or if you really must do some COPY FROM PROGRAM magic (there's your access control) and just store the value somewhere. The more examples of use cases I see, the more I think that actually beneficial use cases are really rare. And now that I checked it: I do have systems with gethostname() returning an FQDN, and other systems return the (short) hostname only. And it gets worse when you're talking "container" and "automatic image deployment". So I believe it's a good thing when a database does not expose too much of the OS below it... Regards, Christoph -- Spare Space