Hi, In v19, a role with privileges of pg_signal_autovacuum_worker can cancel or terminate an autovacuum worker, but not the parallel workers it launches for parallel autovacuum; it gets the superuser error instead. The autovacuum worker advertises no role, while its parallel workers advertise the bootstrap superuser, so they are treated as superuser backends. This has the same cause as the DROP DATABASE ... FORCE failure fixed in a39e53a700c [1], but that commit fixed only that path. One place it shows up is the common query that terminates all other sessions in a database: run by such a role, it now fails with the superuser error when it reaches a parallel worker's row.
The attached 0001 checks a parallel worker as its leader when the leader advertises no role, the same rule a39e53a700c uses. Signaling a parallel worker has the same effect as cancelling its autovacuum worker: the autovacuum worker logs an error for the current table and moves on to the next one. So this doesn't let anyone do more than they already can through the leader. Parallel workers of a background worker connected without a user name stay superuser-only, and those of other leaders are unchanged. 0002 adds a TAP test using the existing parallel vacuum injection point. The fix needs to be backpatched to v19. [1] https://postgr.es/m/CALj2ACWK6PkOk5MTfibtJyTYpb=Aq_8=yaexnpkhoj11boc...@mail.gmail.com Thanks, Adesh Thakare
v1-0001-Let-pg_signal_autovacuum_worker-signal-parallel-a.patch
Description: Binary data
v1-0002-Add-a-test-for-signaling-parallel-autovacuum-work.patch
Description: Binary data
