Re: Adding a pg_servername() function

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>
Cc: 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-06 21:56:07
Message-ID: ZNAW93Kr3j_AZghd@elch.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

## Laetitia Avrot (laetitia(dot)avrot(at)gmail(dot)com):

> I understand your point and sure enough, my customer could set and use the
> cluster_name for that purpose. I totally disagree with using
> inet_server_addr() for that purpose as there are so many different network
> settings with VIPs and so on that it won't help.

That depends a bit on what the exact question is: "where did I connect
to" vs "where is the thing I conencted to running".

> Also, a socket connection
> will give a NULL value, not that it's *that* bad because if it's a socket,
> you're running locally and could still use `\! ifconfig`, but it does not
> work on some configurations (docker for example).

But with a local socket, you already know where you are.

> Also, most humans will
> find it easier to memorize a name than a number and that's one of the
> reasons why we remember websites' URLs instead of their IP.

That's why we have DNS, and it works both ways (especially when
working programatically).

> I still disagree with the monitoring part. A good monitoring tool will have
> to reconcile data from the OS with data from the Postgres cluster. So that,
> we kind of need a way for the monitoring tool to know on which host this
> particular cluster is running and I think it's smarter to get this
> information from the Postgres cluster.

But that's again at least two questions in here: "what is the
instance on this host doing" and "what is the primary/read standby/...
of service X doing", and depending on that ask the base host's
primary address or the service's address. Yes, that's easy to say
when you can define the whole environment, and many setups discover
this only later in the life cycle.

Regards,
Christoph

--
Spare Space

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-08-06 22:15:36 Re: A failure in 031_recovery_conflict.pl on Debian/s390x
Previous Message Peter Geoghegan 2023-08-06 21:43:08 Re: POC, WIP: OR-clause support for indexes