MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / GetPgVersion

Method GetPgVersion

pkg/management/postgres/instance.go:918–935  ·  view source on GitHub ↗

GetPgVersion queries the postgres instance to know the current version, parses it and memoize it for future uses

()

Source from the content-addressed store, hash-verified

916
917// GetPgVersion queries the postgres instance to know the current version, parses it and memoize it for future uses
918func (instance *Instance) GetPgVersion() (semver.Version, error) {
919 // Better not to recompute what we already have
920 if instance.pgVersion != nil {
921 return *instance.pgVersion, nil
922 }
923
924 db, err := instance.GetSuperUserDB()
925 if err != nil {
926 return semver.Version{}, err
927 }
928
929 parsedVersion, err := postgresutils.GetPgVersion(db)
930 if err != nil {
931 return semver.Version{}, err
932 }
933 instance.pgVersion = parsedVersion
934 return *parsedVersion, nil
935}
936
937// ConnectionPool gets or initializes the connection pool for this instance
938func (instance *Instance) ConnectionPool() pool.Pooler {

Callers 11

fillBasebackupStatsMethod · 0.95
TryGetPgStatWALMethod · 0.95
DescribeMethod · 0.80
updateInstanceMetricsMethod · 0.80
collectPGVersionFunction · 0.80
collectPGStatWALFunction · 0.80

Calls 1

GetSuperUserDBMethod · 0.95

Tested by

no test coverage detected