Getting the database cluster and client tools version

The PostgreSQL version allows the developer to know the supported features and helps them write compatible SQL queries for different versions. For example, the process ID attribute name in the pg_stat_activity view in PostgreSQL versions older than 9.2 is procpid; in PostgreSQL version 9.2, this attribute name is pid.

Getting ready

Getting the database and build version right is important because it allows the developer to know the supported features and compatibility between client tools and the backend version.

How to do it…

The version() function, as shown in the following query, shows the version information as well as build system:

car_portal=# SELECT version ();
                           version
------------------------------------------------------------- ...

Get Learning PostgreSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.