agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT.
@ 2026-09-08 19:06  Masahiko Sawada <msawada@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Masahiko Sawada @ 2026-09-08 19:06 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT.
@ 2026-09-08 19:06  Masahiko Sawada <msawada@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Masahiko Sawada @ 2026-09-08 19:06 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-08 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 19:06 pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT. Masahiko Sawada <msawada@postgresql.org>
2026-09-08 19:06 pgsql: Fix REPACK (CONCURRENTLY) when the table owner lacks CONNECT. Masahiko Sawada <msawada@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox