Blah, well, guess I do need the server's address after all. The
attached patch includes:
*) inet_(client|server)_(addr|port)() and necessary documentation for
the four functions.
*) area(PATH) and documentation.
*) Checks for TEMP privs when creating objects in the temp schema
(checks for any object created in a temp namespace).
*) With the above change, current_user is now being used to check if
CREATE TEMP TABLE should succeed.
*) Now cleaning up failed getaddrinfo_all() calls.
*) The check for hintp being null has been removed, all calls to
getaddrinfo_all() are passing non-null hintp's.
*) Changed some freeaddrinfo_all() calls to make sure that the addrinfo
struct is non-null. getaddrinfo_all() can fail and return a null
addrinfo struct and can fail with a non-null addrinfo struct.
*) Updated an error message to include the library path that failed
(handy for debugging old configs that contain $lib instead of $libdir)
*) warn if getaddrinfo_all() fails on postmaster startup.
*) Functions have been updated to be inline with PostgreSQL's style too.
Comments or feedback?
test=# SELECT inet_client_addr();
inet_client_addr
------------------
127.0.0.1
(1 row)
test=# SELECT inet_client_port();
inet_client_port
------------------
52711
(1 row)
test=# SELECT inet_server_port();
inet_server_port
------------------
5432
(1 row)
test=# SELECT inet_server_addr();
inet_server_addr
------------------
127.0.0.1
(1 row)
--
Sean Chittenden