Re: Adding a pg_servername() function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: GF <phabriz(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>, Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding a pg_servername() function
Date: 2023-08-09 16:31:35
Message-ID: 110309.1691598695@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

GF <phabriz(at)gmail(dot)com> writes:
> On Wed, 9 Aug 2023 at 16:05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2023-08-09 16:32:24 Re: [RFC] Clang plugin for catching suspicious typedef casting
Previous Message Dave Cramer 2023-08-09 16:27:37 Re: Using defines for protocol characters