Re: REPACK (CONCURRENTLY) rewrites tables marked with user_catalog_table

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, alvherre(at)kurilemu(dot)de
Subject: Re: REPACK (CONCURRENTLY) rewrites tables marked with user_catalog_table
Date: 2026-08-27 22:46:10
Message-ID: CALj2ACV0h7e+Z7PZEHsQR_St4D7mxDWn6WxAh-rSOoFhzmOZ1A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Aug 27, 2026 at 7:22 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> IIUC this can cause problems for logical replication consumers, since the
> CONCURRENTLY path doesn't go through the rewriteheap.c machinery like the
> non-concurrent path does:
>
> CREATE TABLE t (a INT PRIMARY KEY, b TEXT) WITH (user_catalog_table = true);
> ALTER TABLE t ALTER COLUMN b TYPE varchar(100); -- correctly fails
> REPACK (CONCURRENTLY) t; -- should fail but doesn't
>
> I believe the fix for v19 is to add a check for
> RelationIsUsedAsCatalogTable() in check_concurrent_repack_requirements()
> (plus a corresponding update to the list of CONCURRENTLY limitations in the
> docs).

That's correct. I verified that concurrent repack doesn't write the
pg_logical/mappings files, which decoding later needs to correctly map
the old tuple locations to the new ones after a rewrite, unlike
non-concurrent CLUSTER, VACUUM FULL and REPACK on a user catalog
table. I think restricting user catalog tables, rather than making
concurrent repack support them, is the right choice at this point in
the release cycle.

Please find attached a patch with the suggested doc change. I didn't
add a test, I don't think we need one.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-Restrict-concurrent-repack-on-user-catalog-tables.patch application/octet-stream 2.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-08-27 22:51:35 Re: REPACK (CONCURRENTLY) doesn't check the table AM
Previous Message Masahiko Sawada 2026-08-27 22:42:23 pg_stat_get_autovacuum_scores ignores the main table's reloptions for TOAST tables