Re: Adding a pg_servername() function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: 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 14:04:40
Message-ID: 90215.1691589880@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
> On 09.08.23 08:42, Laetitia Avrot wrote:
>> My question is very simple: Do you oppose having this feature in Postgres?

> I think this is pretty harmless(*) and can be useful, so it seems
> reasonable to pursue.

I actually do object to this, because I think the concept of "server
name" is extremely ill-defined and if we try to support it, we will
forever be chasing requests for alternative behaviors. Just to start
with, is a prospective user expecting a fully-qualified domain name
or just the base name? If the machine has several names (perhaps
associated with different IP addresses), what do you do about that?
I wouldn't be too surprised if users would expect to get the name
associated with the IP address that the current connection came
through. Or at least they might tell you they want that, until
they discover they're getting "localhost.localdomain" on loopback
connections and come right back to bitch about that.

Windows likely adds a whole 'nother set of issues to "what's the
machine name", but I don't know enough about it to say what.

I think the upthread suggestion to use cluster_name is going to
be a superior solution for most people, not least because they
can use it today and it will work the same regardless of platform.

> (*) But we should think about access control for this. If you're in a
> DBaaS environment, providers might not like that you can read out their
> internal host names.

There's that, too.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-08-09 14:11:32 Re: Remove distprep
Previous Message Peter Eisentraut 2023-08-09 13:23:32 Re: [RFC] Clang plugin for catching suspicious typedef casting