GUC Parameters / Preset Options
server_version_num
Read the PG 18 manualReports the version number of the server as an integer.
Reading PG 18current·documented in 21 of 24 versions, 8.2 to 20
- 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 17
Related entries
Further reading
Definition snapshot: english-manuals:2207366be4d31c80868180643e5… · English manual source