Re: Adding REPACK [concurrently]

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Robert Treat <rob(at)xzilla(dot)net>
Subject: Re: Adding REPACK [concurrently]
Date: 2026-04-20 07:44:45
Message-ID: 22189.1776671085@localhost
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:

> I had trouble testing this at first:
>
> postgres=# REPACK (CONCURRENTLY) users;
> ERROR: 42501: permission denied to use replication slots
> DETAIL: Only roles with the REPLICATION attribute may use replication slots.
> CONTEXT: REPACK decoding worker
> LOCATION: CheckSlotPermissions, slot.c:1697
>
> That's surprising, since it was run as a superuser.
>
> It turns out that repack runs as the owner of the table, and the table
> *owner* needs to have REPLICATION -- regardless of who runs the command.
>
> I imagine people have been testing with one user, that both owns the
> table and invokes REPACK. Maybe this just needs to be clarified in the
> documentation/error message?

It was discussed earlier [1] and the concerns about possibly excessive
resource consumptions were addressed by [2]. So I think it the fix was just
forgotten. Attached here.

[1] https://www.postgresql.org/message-id/202603161220.7nv6whwu33hi@alvherre.pgsql
[2] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=e76d8c749c3152657711ed733f0aea61c0e36a91

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

Attachment Content-Type Size
0001-Lock-upgrade-without-deadlocks.patch text/x-diff 16.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-04-20 07:47:36 Re: Adding REPACK [concurrently]
Previous Message Richard Guo 2026-04-20 07:29:04 Re: Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value)