Re: Table AM callback for logical decoding support (REPACK CONCURRENTLY)

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Table AM callback for logical decoding support (REPACK CONCURRENTLY)
Date: 2026-11-20 07:54:58
Message-ID: 5473.1795161298@chrudos
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

> In [1], REPACK (CONCURRENTLY) was restricted to heap because nothing in
> TableAmRoutine says whether an AM can be logically decoded, and without
> decoding the changes made during the rewrite are silently lost. Masahiko
> suggested a callback for HEAD, and Bharath that it wait for a field report.
> Here is one: a table AM we are developing has its own resource manager
> with rm_decode, and the heap-only check refuses it.
>
> The attached patch adds an optional relation_supports_logical_decoding
> callback, last in TableAmRoutine.  An AM without it is taken not to support
> decoding, so existing AMs are unaffected.  heap provides it, and REPACK asks
> the AM instead of comparing its routine with heap's.

Have you considered adding a callback / field that provides the AM's RmgrId ?
The AM needs to know it anyway, at least when inserting WAL records (Well, the
heap AM actually uses two ids, RM_HEAP_ID and RM_HEAP2_ID ...). With this
knowledge, REPACK (CONCURRENTLY) could check whether the rm_decode() callback
exists.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-11-20 07:56:54 Re: Assert "target_wal_endrec == divergerec" in pg_rewind
Previous Message Michael Paquier 2026-11-20 07:49:48 Re: Report buffer access strategies in EXPLAIN