I need to make sure that an available PostgreSQL version is not lower than required one. The version string could be requested as follows:
SELECT VERSION();
It returns me something like:
PostgreSQL 9.5.4, compiled by Visual C++ build 1800, 64-bit
Theoretically I could parse this string, but I am not sure that future versions of PostgreSQL server will keep this word order.
Does PostgreSQL have some predictable version report possibly split in major and minor version number?
show server_version_num; --returns 90602::text
show server_version; --returns 9.6.2::text
https://blog.2ndquadrant.com/finding-postgresql-version/ says:
You can use that more easily within an SQL query like this
SELECT current_setting('server_version_num');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With