Re: Adding a pg_servername() function

From: GF <phabriz(at)gmail(dot)com>
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 10:50:17
Message-ID: CAFePLY2BG3vqqetsH5QxaYrWRcW2YhyF_O=fU5f_Yu=2V_Z9EA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi everybody,

On 09.08.23 08:42, Laetitia Avrot wrote:
> I agree that the feature I'm suggesting could be done with a few tricks.
> I meant to simplify the life of the user by providing a simple new
> feature. (Also, I might have trust issues with DNS due to several past
> production disasters.)

Just my contribution on why this function could be useful, since we had a
use case that fits exactly this.
In the past I needed such a pg_servername() function because in a project I
was engaged on they needed to distribute "requests" directed to a in-house
management service running on network servers, and each one had a DB, so we
went with pglogical to be used as a (transactional) messaging middleware.
The requests were targeted to specific hostnames, thus on the replication
downstream we wanted to filter with a before-insert trigger on the hostname.
At that point, we had to do some contortions to get the hostname the DB was
running on, sometimes really nasty like: on linux servers we could go with
a python function; but on windows ones (where there was no python
available) we had to resort to a function that read the OS "hostname"
command into a temporary table via the pg "copy", which is both tricky and
inefficient.

So, from me +1 to Laetitia's proposal.

On Wed, 9 Aug 2023 at 10:26, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:

> (*) But we should think about access control for this.

And +1 also to Peter's note on enforcing the access control. BTW that's
exactly what we needed with plpythonu, and also with "copy from program".

Best,
Giovanni

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2023-08-09 10:56:06 Re: A failure in 031_recovery_conflict.pl on Debian/s390x
Previous Message David Rowley 2023-08-09 10:37:33 Re: [PoC] Reducing planning time when tables have many partitions