pg_server_version — Get the PostgreSQL server software version
pg_server_version conn
pg_server_version
returns the version of the
connected PostgreSQL server, as an integer. Two digits in the return
value are allocated to each of the major, minor, and revision numbers.
See the example below.
This command does not contact the database server - it uses information supplied by the server at connection time.
This command uses or emulates the PostgreSQL
libpq
function PQserverVersion
.
This command was added in pgtclng-2.0.0 and in pgintcl-3.4.0.
The return value from pg_server_version
contains the
same information as the server_version
parameter. See
pg_parameter_status for more on parameters. Assuming the
PostgreSQL server is running version 8.3.14:
set version_int [pg_server_version $conn] set version_str [pg_parameter_status $conn server_version]
The above will set version_int to 80314, and version_str to "8.3.14".