Contents
inet_client_port()
A system function returning the client port
inet_client_port()
is a system function which returns the IP port number of the current client.
inet_client_port()
was added in PostgreSQL 8.0.
Usage
inet_client_port()
is called without any arguments, and returns the client IP port as an integer, 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_port(); inet_client_port ------------------ 40276 (1 row)
Example output when connected via a Unix-domain socket:
postgres=# SELECT inet_client_port(); inet_client_port ------------------ (1 row)
References
- PostgreSQL documentation: Session Information Functions