Re: Adding a pg_servername() function - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Adding a pg_servername() function
Date
Msg-id 110309.1691598695@sss.pgh.pa.us
Whole thread Raw
In response to Re: Adding a pg_servername() function  (GF <phabriz@gmail.com>)
Responses Re: Adding a pg_servername() function
List 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



pgsql-hackers by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Using defines for protocol characters
Next
From: Dmitry Dolgov
Date:
Subject: Re: [RFC] Clang plugin for catching suspicious typedef casting