Adding a pg_servername() function
Lætitia Avrot <laetitia.avrot@gmail.com>
From: Laetitia Avrot <laetitia.avrot@gmail.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-03T08:36:50Z
Lists: pgsql-hackers
Attachments
- pg_servername_function_v1.patch (application/octet-stream) patch v1
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