PostgreSQL – How to Query Database for Cluster, Version, and Port

postgresql

I can quickly query the database name with SELECT current_database(); but I've been searching for way to also query the cluster name and version with no luck – hoping someone can suggest a solution.

Best Answer

That would be

SELECT current_setting('cluster_name'), current_setting('server_version');

You can get all parameters that way. For automated processing, server_version_num is often better.