server_version_num
Read PG 18 manual ↗Reports the version number of the server as an integer.
- Type
- integer
- Context
- internal
- Measured default
- 180006
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
Reports the version number of the server as an integer. It is determined by the value of PG_VERSION_NUM when building the server.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 9.0 | 90023 |
| 9.1 – 9.1 | 90124 |
| 9.2 – 9.2 | 90223 |
| 9.3 – 9.3 | 90325 |
| 9.4 – 9.4 | 90426 |
| 9.5 – 9.5 | 90525 |
| 9.6 – 9.6 | 90624 |
| 10 – 10 | 100023 |
| 11 – 11 | 110022 |
| 12 – 12 | 120022 |
| 13 – 13 | 130023 |
| 14 – 14 | 140024 |
| 15 – 15 | 150019 |
| 16 – 16 | 160015 |
| 17 – 17 | 170011 |
| 18 – 18 | 180006 |
| 19 – 19 | 190000 |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
Reports the running server binary’s version as an integer. It is internal/read-only and is determined by the binary, not by initdb or database creation.
For the measured PG9.0–19 Beta 3 releases, the integer encodes the major version and minor update so software can make numeric feature/version comparisons without parsing vendor text from server_version.
Use it for compatibility gating only when server-side feature discovery is unavailable. Extensions and clients must still account for vendor backports that do not change the upstream version number.
Operational considerations
Comparing the integer as a string.
Trying to change it with configuration or by recreating a database.
Assuming the number captures vendor backports and downstream patches.
Using a client-library version as a substitute for the connected server version.
Workload guidance
OLAP: Verify coordinator, workers, replicas, and extension builds against the actual server version before enabling version-specific SQL or planner features.
OLTP: Not tunable. Record it from every server after upgrade and use numeric comparisons in deployment checks; changing it means running a different PostgreSQL binary.
SMALL: Use the value for simple compatibility checks, but prefer probing the required feature. Do not attempt to alter it through configuration or initdb.
Version history 16
- PG 18 → 19changed
- PG 17 → 18changed
- PG 16 → 17changed
- PG 15 → 16changed
- PG 14 → 15changed
- PG 13 → 14changed
- PG 12 → 13changed
- PG 11 → 12changed
- PG 10 → 11changed
- PG 9.6 → 10changed
- PG 9.5 → 9.6changed
- PG 9.4 → 9.5changed
- PG 9.3 → 9.4changed
- PG 9.2 → 9.3changed
- PG 9.1 → 9.2changed
- PG 9.0 → 9.1changed
Related entries
Further reading
Definition snapshot: english-manuals:70ed8c21a6e0e5f2d272e46f8db… · English manual source