REPACK (CONCURRENTLY) fails when table owner lacks CONNECT

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: alvherre(at)kurilemu(dot)de
Subject: REPACK (CONCURRENTLY) fails when table owner lacks CONNECT
Date: 2026-08-27 15:46:20
Message-ID: apBbzFd_EYAfHV45@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The REPACK decoding worker doesn't pass BGWORKER_BYPASS_ALLOWCONN like
parallel.c does, so it can fail to start. Here is a reproducer:

CREATE DATABASE d;
REVOKE CONNECT ON DATABASE d FROM PUBLIC;
\c d
CREATE ROLE r NOLOGIN;
CREATE TABLE t (a INT PRIMARY KEY);
ALTER TABLE t OWNER TO r;
REPACK t; -- works
REPACK (CONCURRENTLY) t; -- fails

That last command produces the following output:

ERROR: permission denied for database "d"
DETAIL: User does not have CONNECT privilege.
CONTEXT: REPACK decoding worker

This one seems easy enough to fix.

--
nathan

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pierre Forstmann 2026-08-27 15:49:50 Re: BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work
Previous Message Nathan Bossart 2026-08-27 15:11:45 REPACK ONLY is accepted but ignored