Adding a pg_servername() function

From: Laetitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Adding a pg_servername() function
Date: 2023-08-03 08:36:50
Message-ID: CAB_COdj9eGCOy_=WcPZ8SCVtTH1eRr=QMJ18UAeOttroFrVbtQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Hackers,

One of my customers suggested creating a function that could return the
server's hostname.

After a quick search, we found [this Wiki page](
https://wiki.postgresql.org/wiki/Pg_gethostname) referring to [that
extension](https://github.com/theory/pg-hostname/) from David E. Wheeler.

I used shamelessly the idea and created a working proof of concept:

- the function takes no argument and returns the hostname or a null value
if any error occurs
- the function was added to the network.c file because it makes sense to me
to have that near the inet_server_addr() and inet_server_port() functions.
- I didn't add any test as the inet functions are not tested either.

If you think my design is good enough, I'll go ahead and port/test that
function for Windows.

Have a nice day,

Lætitia

Attachment Content-Type Size
pg_servername_function_v1.patch application/octet-stream 2.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2023-08-03 08:37:39 Re: generic plans and "initial" pruning
Previous Message Ashutosh Bapat 2023-08-03 08:21:33 Re: Inquiry about Functionality Availability in PostgreSQL