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-03 13:17:14
Message-ID: ZMuo2ix8PqnDEe4/@squirrel.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

> For my customer, their use case is to be able from an SQL client to double
> check they're on the right host before doing things that could become a
> production disaster.

Why not use cluster_name for that? Even if it may not be relevant
for their setup, there might be multiple clusters on the same host
(multiple clusters with the same hostname) or you database could be
hiding behind some failover/loadbalancer mechanism (multiple hostnames
in one cluster), thus using the hostname to identify the cluster is
totally not universal (the same goes for the monitoring/metrics
stuff). And there's of course inet_server_addr(), if you really
need to double-check if you're connected to the right machine.

Regards,
Christoph

--
Spare Space.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2023-08-03 13:22:48 Re: Extract numeric filed in JSONB more effectively
Previous Message Chapman Flack 2023-08-03 12:34:44 Re: Extract numeric filed in JSONB more effectively