Re: Adding a pg_servername() function
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: GF <phabriz@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>,
Laetitia Avrot <laetitia.avrot@gmail.com>,
Christoph Moench-Tegeder <cmt@burggraben.net>,
Matthias van de Meent <boekewurm+postgres@gmail.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-09T16:31:35Z
Lists: pgsql-hackers
GF <phabriz@gmail.com> writes: > On Wed, 9 Aug 2023 at 16:05, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> I actually do object to this, because I think the concept of "server >> name" is extremely ill-defined > But the gethostname() function is well defined, both in Linux and in > Windows. Sure, its call convention is standardized. But I see nothing in POSIX saying whether it returns a FQDN or just some random name. In any case, the bigger issue is that I don't really want us to expose a function defined as "whatever gethostname() says". I think there will be portability issues on some platforms, and I am dubious that that definition is what people would want. One concrete reason why I am doubtful about this is the case of multiple PG servers running on the same machine. gethostname() will be unable to distinguish them. regards, tom lane