Skip to content

Commit 37bf98f

Browse files
committed
Add PG17 support
1 parent 154501b commit 37bf98f

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

pkg/pgutils/utils.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const (
1616
MajorVersion14 = "14"
1717
MajorVersion15 = "15"
1818
MajorVersion16 = "16"
19+
MajorVersion17 = "17"
1920
)
2021

2122
const (
@@ -46,7 +47,7 @@ func ToPGMajorVersion(val string) (string, error) {
4647
return "", fmt.Errorf(errCouldNotParseVersionFmt, val)
4748
}
4849
switch res[1] {
49-
case MajorVersion10, MajorVersion11, MajorVersion12, MajorVersion13, MajorVersion14, MajorVersion15, MajorVersion16:
50+
case MajorVersion10, MajorVersion11, MajorVersion12, MajorVersion13, MajorVersion14, MajorVersion15, MajorVersion16, MajorVersion17:
5051
return res[1], nil
5152
case "7", "8", "9":
5253
return res[1] + res[2], nil

pkg/tstune/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
// ValidPGVersions is a slice representing the major versions of PostgreSQL
1313
// for which recommendations can be generated.
1414
var ValidPGVersions = []string{
15+
pgutils.MajorVersion17,
1516
pgutils.MajorVersion16,
1617
pgutils.MajorVersion15,
1718
pgutils.MajorVersion14,

pkg/tstune/utils_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ func TestGetPGMajorVersion(t *testing.T) {
120120
okPath14 := "pg_config_14"
121121
okPath15 := "pg_config_15"
122122
okPath16 := "pg_config_16"
123+
okPath17 := "pg_config_17"
123124
okPath95 := "pg_config_9.5"
124125
okPath60 := "pg_config_6.0"
125126
cases := []struct {
@@ -198,6 +199,8 @@ func TestGetPGMajorVersion(t *testing.T) {
198199
return "PostgreSQL 15.0", nil
199200
case okPath16:
200201
return "PostgreSQL 16.0", nil
202+
case okPath17:
203+
return "PostgreSQL 17.0", nil
201204
default:
202205
return "", exec.ErrNotFound
203206
}
@@ -235,6 +238,7 @@ func TestValidatePGMajorVersion(t *testing.T) {
235238
pgutils.MajorVersion14: true,
236239
pgutils.MajorVersion15: true,
237240
pgutils.MajorVersion16: true,
241+
pgutils.MajorVersion17: true,
238242
"9.5": false,
239243
"1.2.3": false,
240244
"9.6.6": false,

0 commit comments

Comments
 (0)