Re: Adding a pg_servername() function

From: Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>
To: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding a pg_servername() function
Date: 2023-08-03 10:06:11
Message-ID: CAB_COdj33xCM9utPHKsGxOigVT9uEBfriy21_r9jQwkOMKMrZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le jeu. 3 août 2023, 11:31, Matthias van de Meent <
boekewurm+postgres(at)gmail(dot)com> a écrit :

> On Thu, 3 Aug 2023 at 10:37, Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)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:
https://github.com/vyruss/pg_statviz/blob/7cd0c694cea40f780fb8b76275c6097b5d210de6/src/pg_statviz/libs/info.py#L30

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)
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-08-03 10:26:58 Re: [PoC] pg_upgrade: allow to upgrade publisher node
Previous Message Matthias van de Meent 2023-08-03 10:04:18 Re: Extract numeric filed in JSONB more effectively