pg_server_version

pg_server_version — Get the PostgreSQL server software version

Synopsis

pg_server_version conn

Description

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.

Arguments

conn

The handle of the connection to query

Return Value

An integer representing the PostgreSQL software version number.

Notes

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.

Example

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".

SourceForge.net Logo

This version of the manual was produced for the Pgtcl-ng Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the Pgtcl-ng project downloads area.