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

From Laetitia Avrot
Subject Re: Adding a pg_servername() function
Date
Msg-id CAB_COdj33xCM9utPHKsGxOigVT9uEBfriy21_r9jQwkOMKMrZw@mail.gmail.com
Whole thread Raw
In response to Re: Adding a pg_servername() function  (Matthias van de Meent <boekewurm+postgres@gmail.com>)
Responses Re: Adding a pg_servername() function
Re: Adding a pg_servername() function
List pgsql-hackers


Le jeu. 3 août 2023, 11:31, Matthias van de Meent <boekewurm+postgres@gmail.com> a écrit :
On Thu, 3 Aug 2023 at 10:37, Laetitia Avrot <laetitia.avrot@gmail.com> wrote:
>
> Dear Hackers,
>
> One of my customers suggested creating a function that could return the server's hostname.

Mostly for my curiosity: What would be their use case?

Thank you for showing interest in that patch.

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. 

I see also another use case: being able to identify postgres metrics on a monitoring tool. Look at the hack pg_staviz uses here: 

Those are the  use cases I can think of.

I only see limited usability, considering that the local user's
hostname can be very different from the hostname used in the url that
connects to that PostgreSQL instance.

Agreed, depending on how hosts and dns are set,  it can be useless. But normally,  companies have host making standards to avoid that.

Have a nice day, 

Lætitia 


Kind regards,

Matthias van de Meent
Neon (https://neon.tech)

pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: Extract numeric filed in JSONB more effectively
Next
From: Amit Kapila
Date:
Subject: Re: [PoC] pg_upgrade: allow to upgrade publisher node