PostgreSQL inet_server_port() Function
The PostgreSQL inet_server_port() function returns the IP port of the server that accepts the current connection.
inet_server_port() Syntax
Here is the syntax of the PostgreSQL inet_server_port() function:
inet_server_port() -> integer
Parameters
The PostgreSQL inet_server_port() function does not require any parameters.
Return value
The PostgreSQL inet_server_port() function returns the IP port of the server that accepts the current connection.
inet_server_port() Examples
To get the port number of the PostgreSQL server, use the following statement with the inet_server_port() function:
SELECT inet_server_port();
inet_server_port
------------------
5432Note, 5432 is the default port number for the PostgreSQL server.