select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / PRESET OPTIONS

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 intervalDefault
9.0 – 9.090023
9.1 – 9.190124
9.2 – 9.290223
9.3 – 9.390325
9.4 – 9.490426
9.5 – 9.590525
9.6 – 9.690624
10 – 10100023
11 – 11110022
12 – 12120022
13 – 13130023
14 – 14140024
15 – 15150019
16 – 16160015
17 – 17170011
18 – 18180006
19 – 19190000
Analysis & operational context

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
  1. PG 18 → 19changed
  2. PG 17 → 18changed
  3. PG 16 → 17changed
  4. PG 15 → 16changed
  5. PG 14 → 15changed
  6. PG 13 → 14changed
  7. PG 12 → 13changed
  8. PG 11 → 12changed
  9. PG 10 → 11changed
  10. PG 9.6 → 10changed
  11. PG 9.5 → 9.6changed
  12. PG 9.4 → 9.5changed
  13. PG 9.3 → 9.4changed
  14. PG 9.2 → 9.3changed
  15. PG 9.1 → 9.2changed
  16. PG 9.0 → 9.1changed

Related entries

Further reading

Definition snapshot: english-manuals:70ed8c21a6e0e5f2d272e46f8db… · English manual source