diff --git a/changelogs/fragments/1078-postgresql_ext_fix_version_selection_when_version_is_latest.yml b/changelogs/fragments/1078-postgresql_ext_fix_version_selection_when_version_is_latest.yml new file mode 100644 index 0000000000..1c72755dce --- /dev/null +++ b/changelogs/fragments/1078-postgresql_ext_fix_version_selection_when_version_is_latest.yml @@ -0,0 +1,2 @@ +bugfixes: +- postgresql_ext - fix version selection when ``version=latest`` (https://github.com/ansible-collections/community.general/pull/1078). diff --git a/plugins/modules/database/postgresql/postgresql_ext.py b/plugins/modules/database/postgresql/postgresql_ext.py index 867350c923..6a3dfdae6c 100644 --- a/plugins/modules/database/postgresql/postgresql_ext.py +++ b/plugins/modules/database/postgresql/postgresql_ext.py @@ -295,7 +295,7 @@ def ext_get_versions(cursor, ext): if current_version == '0': current_version = False - return (current_version, available_versions) + return (current_version, sorted(available_versions, key=LooseVersion)) # =========================================== # Module execution.