| From: | Masahiko Sawada <msawada(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT. |
| Date: | 2026-09-08 19:06:43 |
| Message-ID: | E1x419W-000000041zO-0eMb@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT.
REPACK (CONCURRENTLY) launches a background worker to decode changes
made while the table is being rewritten. The worker connects as the
table owner but bypassed the LOGIN check only, so CONNECT was still
checked against a role that need not have it, and the command could
fail with "permission denied for database".
Pass BGWORKER_BYPASS_ALLOWCONN as well, as we do for parallel
workers. That is safe because the leader already checked the invoking
user's privileges on the table before starting the worker.
Reported-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Author: Matheus Alcantara <mths(dot)dev(at)pm(dot)me>
Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Reviewed-by: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Reviewed-by: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Discussion: https://postgr.es/m/apBbzFd_EYAfHV45@nathan
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0717ed2623683cbbe206d0b651817a3a1e0cf0de
Modified Files
--------------
src/backend/commands/repack_worker.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-09-08 19:06:47 | pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT. |
| Previous Message | Masahiko Sawada | 2026-09-08 18:51:02 | pgsql: Restrict REPACK (CONCURRENTLY) to the heap access method. |