diff --git a/changelogs/fragments/postgresol_privs-fix-status-sorting.yaml b/changelogs/fragments/postgresol_privs-fix-status-sorting.yaml new file mode 100644 index 00000000000..e62a249e6b5 --- /dev/null +++ b/changelogs/fragments/postgresol_privs-fix-status-sorting.yaml @@ -0,0 +1,2 @@ +bugfixes: + - postgresql_privs - sort results before comparing so that the values are compared and not the result of ``.sort()`` (https://github.com/ansible/ansible/pull/65125) diff --git a/lib/ansible/modules/database/postgresql/postgresql_privs.py b/lib/ansible/modules/database/postgresql/postgresql_privs.py index eafe4578d3e..b235d96c6a9 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_privs.py +++ b/lib/ansible/modules/database/postgresql/postgresql_privs.py @@ -780,7 +780,9 @@ class Connection(object): executed_queries.append(query) self.cursor.execute(query) status_after = get_status(objs) - return status_before.sort() != status_after.sort() + status_before.sort() + status_after.sort() + return status_before != status_after class QueryBuilder(object):