Skip to content

Commit d3052d5

Browse files
JiriCtvrtkaCopilot
andauthored
Update agent/utils/version/postgresql.go
Co-authored-by: Copilot <[email protected]>
1 parent 03a1a93 commit d3052d5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

agent/utils/version/postgresql.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ var (
2424
postgresDBRegexp = regexp.MustCompile(`PostgreSQL ([\d\.]+)`)
2525
)
2626

27-
// ParsePostgreSQLVersion parses the given PostgreSQL version string.
27+
// ParsePostgreSQLVersion parses the given PostgreSQL version string (such as the
28+
// output of `SELECT version()`) and returns the major version and the second
29+
// numeric component as strings.
30+
//
31+
// For PostgreSQL versions prior to 10, this typically corresponds to
32+
// "major" and "minor" (e.g., 9.6.5 -> "9", "6"). For PostgreSQL 10 and above,
33+
// PostgreSQL uses a two-part versioning scheme where the second component is
34+
// the patch level (e.g., 18.2 -> "18", "2"), not a traditional minor version.
2835
func ParsePostgreSQLVersion(v string) (string, string) {
2936
m := postgresDBRegexp.FindStringSubmatch(v)
3037
if len(m) != 2 {

0 commit comments

Comments
 (0)