Functions
The following functions are available globally.
-
Return the version of libpq that is being used.
Note
See PGlibRawVersion() for details
Example version 10.1 -> 100001 -> major: 10, submajor: 0, minor: 1
Example version 11.0 -> 110000 -> major: 11, submajor: 0, minor: 0
Example version 9.2.0 -> 90200 -> major: 9, submajor: 2: minor: 0
Example version 9.1.5 -> 90105 -> major: 9, submajor: 1, minor: 5Declaration
Swift
public func PGlibVersion() -> (major: Int, submajor: Int, minor: Int)
Return Value
The major, submajor and minor number
-
Return the version of libpq that is being used.
The result of this function can be used to determine, at run time, whether specific functionality is available in the currently loaded version of libpq. The function can be used, for example, to determine which connection options are available in PQconnectdb.
The result is formed by multiplying the library’s major version number by 10000 and adding the minor version number. For example, version 10.1 will be returned as 100001, and version 11.0 will be returned as 110000.
Prior to major version 10, PostgreSQL used three-part version numbers in which the first two parts together represented the major version. For those versions, PQlibVersion uses two digits for each part; for example version 9.1.5 will be returned as 90105, and version 9.2.0 will be returned as 90200.
Therefore, for purposes of determining feature compatibility, applications should divide the result of PQlibVersion by 100 not 10000 to determine a logical major version number. In all release series, only the last two digits differ between minor releases (bug-fix releases).
Declaration
Swift
public func PGlibRawVersion() -> Int32