PG_VERSION (file)

A standard data directory file containing the PostgreSQL major version

The file PG_VERSION is located at the top level of every PostgreSQL data directory; it is a plain text file containing just the major PostgreSQL version of the server using the data directory.

Source code

PG_VERSION is parsed by ValidatePgVersion() in src/backend/utils/init/miscinit.c.

Examples

In PostgreSQL 10 and later, the version is always a single number:

$ cat /var/lib/pgsql/data/PG_VERSION 
13

In PostgreSQL 9.6 and earlier, the value shows the version expressed in series.major_release format:

$ cat /var/lib/pgsql/data/PG_VERSION 
9.6

Categories

PostgreSQL internals

See also

PG_VERSION (constant)