Catalog version number
The catalog version number
is a number defining the system catalog version.
Purpose of the catalog version number
is to prevent a PostgreSQL instance being started up against a data directory with an incompatible format. This is usually only relevant when running pre-release development versions.
The catalog version number
remains stable throughout the lifetime of a major release.
Format
The catalog version number
is in YYYYMMDDN
format, representing the date the number was changed, with N representing a simple counter to accomodate for more than one change on the same date.
Obtaining the catalog version number
The catalog version number
is contained in the pg_control file and can be retrieved with the pg_controldata utility, or from the pg_control_system()
function (PostgreSQL 9.6 and later).
See below for examples.
Usage
The catalog version number
is an internal implementation detail and is of no particular relevance for normal database operations.
The only place it is likely to be visible to any extent is as part of the internal directory name created within a tablespace directory.
Source code
The catalog version number
is defined in src/include/catalog/catversion.h.
Examples
Obtaining the catalogue version number
from pg_control:
pg_controldata -D /var/lib/pgsql/data pg_control version number: 1300 Catalog version number: 202010291 Database system identifier: 6891881161586929758 ...
Obtaining the catalogue version number from pg_control_system():
postgres=# SELECT catalog_version_no FROM pg_control_system(); catalog_version_no -------------------- 202010291 (1 row)