public inbox for [email protected]
help / color / mirror / Atom feedFrom: Álvaro Herrera <[email protected]>
Subject: [PATCH 2/2] REPACK: do not require LOGIN privileges
Date: Mon, 20 Apr 2026 13:19:49 +0200
Normally, starting a background worker does require LOGIN, which is
fine. However, the bgworker used for REPACK has no business requiring
it. It's just user-unfriendly and prevents repacking tables
comfortably.
---
src/backend/commands/repack_worker.c | 5 +++--
src/test/regress/expected/cluster.out | 2 +-
src/test/regress/sql/cluster.sql | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/backend/commands/repack_worker.c b/src/backend/commands/repack_worker.c
index e4a4860805b..c40f8c98e06 100644
--- a/src/backend/commands/repack_worker.c
+++ b/src/backend/commands/repack_worker.c
@@ -106,8 +106,9 @@ RepackWorkerMain(Datum main_arg)
pq_set_parallel_leader(shared->backend_pid,
shared->backend_proc_number);
- /* Connect to the database. */
- BackgroundWorkerInitializeConnectionByOid(shared->dbid, shared->roleid, 0);
+ /* Connect to the database. LOGIN is not required. */
+ BackgroundWorkerInitializeConnectionByOid(shared->dbid, shared->roleid,
+ BGWORKER_BYPASS_ROLELOGINCHECK);
/*
* Transaction is needed to open relation, and it also provides us with a
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index e17bc91fae1..71270134985 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -546,7 +546,7 @@ DROP TABLE clstrpart;
CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
CREATE INDEX ptnowner_i_idx ON ptnowner(i);
CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
-CREATE ROLE regress_ptnowner LOGIN;
+CREATE ROLE regress_ptnowner;
CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 1f471a8821a..6746236ffec 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -257,7 +257,7 @@ DROP TABLE clstrpart;
CREATE TABLE ptnowner(i int unique not null) PARTITION BY LIST (i);
CREATE INDEX ptnowner_i_idx ON ptnowner(i);
CREATE TABLE ptnowner1 PARTITION OF ptnowner FOR VALUES IN (1);
-CREATE ROLE regress_ptnowner LOGIN;
+CREATE ROLE regress_ptnowner;
CREATE TABLE ptnowner2 PARTITION OF ptnowner FOR VALUES IN (2);
ALTER TABLE ptnowner1 OWNER TO regress_ptnowner;
SET SESSION AUTHORIZATION regress_ptnowner;
--
2.47.3
--m6zy3l65ushq557m--
view thread (535+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH 2/2] REPACK: do not require LOGIN privileges
In-Reply-To: <no-message-id-1222003@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox