Add option to bgworkers to allow the bypass of role login check
Michael Paquier <michael@paquier.xyz>
Add option to bgworkers to allow the bypass of role login check This adds a new option called BGWORKER_BYPASS_ROLELOGINCHECK to the flags available to BackgroundWorkerInitializeConnection() and BackgroundWorkerInitializeConnectionByOid(). This gives the possibility to bgworkers to bypass the role login check, making possible the use of a role that has no login rights while not being a superuser. PostgresInit() gains a new flag called INIT_PG_OVERRIDE_ROLE_LOGIN, taking advantage of the refactoring done in 4800a5dfb4c4. Regression tests are added to worker_spi to check the behavior of this new option with bgworkers. Author: Bertrand Drouvot Reviewed-by: Nathan Bossart, Michael Paquier, Bharath Rupireddy Discussion: https://postgr.es/m/bcc36259-7850-4882-97ef-d6b905d2fc51@gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/bgworker.sgml | modified | +3 −0 |
| src/backend/postmaster/postmaster.c | modified | +6 −0 |
| src/backend/utils/init/miscinit.c | modified | +2 −2 |
| src/backend/utils/init/postinit.c | modified | +4 −2 |
| src/include/miscadmin.h | modified | +3 −1 |
| src/include/postmaster/bgworker.h | modified | +4 −2 |
| src/test/modules/worker_spi/t/001_worker_spi.pl | modified | +30 −0 |
| src/test/modules/worker_spi/worker_spi.c | modified | +2 −0 |
Documentation touched
Discussion
- Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag 41 messages · 2023-09-28 → 2023-10-16