Skip to content

Commit

Permalink
Add PG16 support
Browse files Browse the repository at this point in the history
  • Loading branch information
svenklemm committed Oct 12, 2023
1 parent 4ffb01b commit f67ec41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/pgutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
MajorVersion13 = "13"
MajorVersion14 = "14"
MajorVersion15 = "15"
MajorVersion16 = "16"
)

const (
Expand Down Expand Up @@ -45,7 +46,7 @@ func ToPGMajorVersion(val string) (string, error) {
return "", fmt.Errorf(errCouldNotParseVersionFmt, val)
}
switch res[1] {
case MajorVersion10, MajorVersion11, MajorVersion12, MajorVersion13, MajorVersion14, MajorVersion15:
case MajorVersion10, MajorVersion11, MajorVersion12, MajorVersion13, MajorVersion14, MajorVersion15, MajorVersion16:
return res[1], nil
case "7", "8", "9":
return res[1] + res[2], nil
Expand Down
1 change: 1 addition & 0 deletions pkg/tstune/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// ValidPGVersions is a slice representing the major versions of PostgreSQL
// for which recommendations can be generated.
var ValidPGVersions = []string{
pgutils.MajorVersion16,
pgutils.MajorVersion15,
pgutils.MajorVersion14,
pgutils.MajorVersion13,
Expand Down
4 changes: 4 additions & 0 deletions pkg/tstune/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func TestGetPGMajorVersion(t *testing.T) {
okPath13 := "pg_config_13"
okPath14 := "pg_config_14"
okPath15 := "pg_config_15"
okPath16 := "pg_config_16"
okPath95 := "pg_config_9.5"
okPath60 := "pg_config_6.0"
cases := []struct {
Expand Down Expand Up @@ -195,6 +196,8 @@ func TestGetPGMajorVersion(t *testing.T) {
return "PostgreSQL 14.0", nil
case okPath15:
return "PostgreSQL 15.0", nil
case okPath16:
return "PostgreSQL 16.0", nil
default:
return "", exec.ErrNotFound
}
Expand Down Expand Up @@ -231,6 +234,7 @@ func TestValidatePGMajorVersion(t *testing.T) {
pgutils.MajorVersion13: true,
pgutils.MajorVersion14: true,
pgutils.MajorVersion15: true,
pgutils.MajorVersion16: true,
"9.5": false,
"1.2.3": false,
"9.6.6": false,
Expand Down

0 comments on commit f67ec41

Please sign in to comment.