v.20.12New Feature

New tcpPort Function for Retrieving Server TCP Port

New tcpPort function returns TCP port listened by this server. #17134 (Ivan).
Introduces a new tcpPort function that returns the TCP port number on which the ClickHouse server is listening.

Why it matters

This feature allows users to programmatically retrieve the TCP port of the running ClickHouse server, which is useful for diagnostics, monitoring, and dynamic configuration scenarios where the server's listening port is needed.

How to use it

Use the new tcpPort() function in your SQL queries to obtain the TCP port. For example:

SELECT tcpPort()