model-writtenrun 7401 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Michael Paquier proposed checking superuser privileges before looking up the target process, avoiding unnecessary acquisition of ProcArrayLock by unauthorized callers, and attached the fix #1.
- Julien Rouhaud explained that other unprivileged operations already acquire the lock and expose backend PIDs, but supported consistently returning a permission error #2.
- Bharath Rupireddy noted that pg_signal_backend also checks permissions after acquiring the lock, partly because its checks require the target process's role information #3.
- Tom Lane supported checking privileges first because future code rearrangements could invalidate arguments that the preceding operations are harmless #4.
- Michael Paquier committed the attached patch unchanged as 4e47b02834 and announced its application #5; the discussion supplied rationale but no qualifying patch review under the requested strict criteria.
- After Fujii Masao thanked him #6, Atsushi Torikoshi said he would correct the same ordering in another proposed patch #7, and Michael endorsed consistency #8; this thread's fix was complete.