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: pg_servername_function_v1.patch
Description: Binary data

Reply via email to