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

From Laetitia Avrot
Subject Adding a pg_servername() function
Date
Msg-id CAB_COdj9eGCOy_=WcPZ8SCVtTH1eRr=QMJ18UAeOttroFrVbtQ@mail.gmail.com
Whole thread Raw
Responses Re: Adding a pg_servername() function
List 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

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Inquiry about Functionality Availability in PostgreSQL
Next
From: Amit Langote
Date:
Subject: Re: generic plans and "initial" pruning