Contents
inet_client_addr()
A function returning the client IP address
inet_client_addr()
is a system function which returns the IP address of the current client.
inet_client_addr()
was added in PostgreSQL 8.0.
Usage
inet_client_addr () → inet
inet_client_addr()
is called without any arguments, and returns the client IP address as the inet
data type, or NULL
if the current connection is via a Unix-domain socket.
Change history
- PostgreSQL 8.0
- added (commit 97d625dd)
Examples
Example output when connected via TCP/IP:
postgres=# SELECT inet_client_addr(); inet_client_addr ------------------ 10.11.9.5 (1 row)
Example output when connected via a Unix-domain socket:
postgres=# SELECT inet_client_addr(); inet_client_addr ------------------ (1 row)
References
- PostgreSQL documentation: Session Information Functions