diff --git a/lib/backup_restore/restorer.rb b/lib/backup_restore/restorer.rb index c7ff9266d56..1e95502242e 100644 --- a/lib/backup_restore/restorer.rb +++ b/lib/backup_restore/restorer.rb @@ -11,7 +11,7 @@ module BackupRestore attr_reader :success def self.pg_produces_portable_dump?(version) - version = Gem::Version.new(version) + gem_version = Gem::Version.new(version) %w{ 10.3 @@ -20,7 +20,9 @@ module BackupRestore 9.4.17 9.3.22 }.each do |unportable_version| - return false if Gem::Dependency.new("", "~> #{unportable_version}").match?("", version) + # anything pg 11 or above will produce a non-portable dump + return false if version.to_i >= 11 + return false if Gem::Dependency.new("", "~> #{unportable_version}").match?("", gem_version) end true diff --git a/spec/lib/backup_restore/restorer_spec.rb b/spec/lib/backup_restore/restorer_spec.rb index 1cd1dd698eb..49f829b27e5 100644 --- a/spec/lib/backup_restore/restorer_spec.rb +++ b/spec/lib/backup_restore/restorer_spec.rb @@ -12,6 +12,9 @@ describe BackupRestore::Restorer do "10.3" => false, "10.3.1" => false, "10.4" => false, + "11" => false, + "11.4" => false, + "21" => false, }.each do |key, value| expect(described_class.pg_produces_portable_dump?(key)).to eq(value) end