PostgreSQL inet_client_port() Function
The PostgreSQL inet_client_port() function returns the current client’s IP port number.
inet_client_port() Syntax
Here is the syntax of the PostgreSQL inet_client_port() function:
inet_client_port() -> integer
Parameters
The PostgreSQL inet_client_port() function does not require any parameters.
Return value
The PostgreSQL inet_client_port() function returns a number which is the current client’s IP port number.
inet_client_port() Examples
To get the current client’s IP port number, use the following statement with the inet_client_port() function:
SELECT inet_client_port();
 inet_client_port
------------------
            63652Note that client port numbers are generally assigned randomly.