pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT. - Mailing list pgsql-committers

From Masahiko Sawada
Subject pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT.
Date
Msg-id E1x419a-00000004202-0S6E@gemulon.postgresql.org
Whole thread
List 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@gmail.com>
Author: Matheus Alcantara <mths.dev@pm.me>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/apBbzFd_EYAfHV45@nathan
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9bf3a414560d93ef8e8cf61748cd5783ab4bc9f9

Modified Files
--------------
src/backend/commands/repack_worker.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: pg_stash_advice: Fix failure to reload empty advice string.
Next
From: Masahiko Sawada
Date:
Subject: pgsql: Restrict REPACK (CONCURRENTLY) on user catalog tables.