HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to query a postgresql database to determine it's cluster and version (and port)?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresqlversionquerydatabasedeterminehowandportcluster

Problem

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.

Solution

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.

Code Snippets

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

Context

StackExchange Database Administrators Q#242433, answer score: 8

Revisions (0)

No revisions yet.