Andrew Dunstan <[email protected]> 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


Reply via email to