Skip to content

Commit 9c5c5b9

Browse files
committed
Problem: pgpm picks up earliest matching Postgres version
If we, say, specify `--pgver 16`, it'll pick up 16.0. However, this is not the behavior we'd like. We want the _latest_ minor of this major. Solution: ensure sorting is done
1 parent e1694da commit 9c5c5b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exe/pgpm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module Pgpm
7878
end
7979

8080
pgver = Package::Version.new(pgver)
81-
matching_pgver = Postgres::Distribution.versions.find { |v| v.satisfies?(">= #{pgver}") && v.satisfies?("< #{pgver.major + 1}") }
81+
matching_pgver = Postgres::Distribution.versions.sort.reverse.find { |v| v.satisfies?(">= #{pgver}") && v.satisfies?("< #{pgver.major + 1}") }
8282
unless matching_pgver
8383
puts "#{pgver} is not a known Postgres version"
8484
exit(1)

0 commit comments

Comments
 (0)