From: Nathan Bossart Date: Fri, 31 Jul 2026 15:34:40 +0000 (-0500) Subject: Fix autovacuum's database sorting. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3331578b58650be6811e842d79937c4a51b74ef;p=thirdparty%2Fpostgresql.git Fix autovacuum's database sorting. When db_comparator() was updated to use pg_cmp_s32(), the arguments were listed in the wrong order. This caused autovacuum to sort the databases by their scores in ascending order instead of descending order. To fix, swap the arguments to pg_cmp_s32(). Oversight in commit 3b42bdb471. Reported-by: Хамидуллин Рустам Author: Хамидуллин Рустам Discussion: https://postgr.es/m/5c5a7984-b149-b505-7ad9-2a7766c65b55%40postgrespro.ru Backpatch-through: 17 --- diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index e9aaf24c1be..0c975d0eda6 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1119,8 +1119,8 @@ rebuild_database_list(Oid newdb) static int db_comparator(const void *a, const void *b) { - return pg_cmp_s32(((const avl_dbase *) a)->adl_score, - ((const avl_dbase *) b)->adl_score); + return pg_cmp_s32(((const avl_dbase *) b)->adl_score, + ((const avl_dbase *) a)->adl_score); } /*