Re: Allow non-superuser to cancel superuser tasks.

Leung, Anthony <antholeu@amazon.com>

From: "Leung, Anthony" <antholeu@amazon.com>
To: "Andrey M. Borodin" <x4mmm@yandex-team.ru>, Nathan Bossart <nathandbossart@gmail.com>
Cc: Kirill Reshke <reshkekirill@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2024-04-04T00:36:45Z
Lists: pgsql-hackers
Update - the condition should be && 

	if (pgstat_get_backend_type(proc->backendId) == B_AUTOVAC_WORKER)
	{
		if (!has_privs_of_role(GetUserId(), ROLE_PG_SIGNAL_AUTOVACUUM) && !superuser())
			return SIGNAL_BACKEND_NOAUTOVACUUM;
	}

Thanks
--
Anthony Leung
Amazon Web Services: https://aws.amazon.com

Commits

  1. Look up backend type in pg_signal_backend() more cheaply.

  2. Add tap test for pg_signal_autovacuum role

  3. Introduce pg_signal_autovacuum_worker.

  4. Add a slot synchronization function.

  5. Ban role pg_signal_backend from more superuser backend types.