Hi hackers! While working on [0] i have noticed this comment in TerminateOtherDBBackends function:
/* * Check whether we have the necessary rights to terminate other * sessions. We don't terminate any session until we ensure that we * have rights on all the sessions to be terminated. These checks are * the same as we do in pg_terminate_backend. * * In this case we don't raise some warnings - like "PID %d is not a * PostgreSQL server process", because for us already finished session * is not a problem. */ This statement is not true after 3a9b18b. "These checks are the same as we do in pg_terminate_backend." But the code is still correct, I assume... or not? In fact, we are killing autovacuum workers which are working with a given database (proc->roleId == 0), which is OK in that case. Are there any other cases when proc->roleId == 0 but we should not be able to kill such a process? [0] https://www.postgresql.org/message-id/flat/CALdSSPiOLADNe1ZS-1dnQXWVXgGAC6%3D3TBKABu9C3_97YGOoMg%40mail.gmail.com#4e869bc4b6ad88afe70e4484ffd256e2