Re: logical decoding and replication of sequences

Tomas Vondra <tomas.vondra@enterprisedb.com>

From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Petr Jelinek <petr.jelinek@enterprisedb.com>, Amit Kapila <amit.kapila16@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-03-25T10:34:14Z
Lists: pgsql-hackers
On 3/25/22 08:00, Masahiko Sawada wrote:
> On Fri, Mar 25, 2022 at 6:59 AM Tomas Vondra
> <tomas.vondra@enterprisedb.com> wrote:
>>
>> Hi,
>>
>> Pushed, after going through the patch once more, addressed the remaining
>> FIXMEs, corrected a couple places in the docs and comments, etc. Minor
>> tweaks, nothing important.
>>
> 
> The commit updates tab-completion for ALTER PUBLICATION but seems not
> to update for CREATE PUBLICATION. I've attached a patch for that.
> 

Thanks. I'm pretty sure the patch did that, but it likely got lost in
one of the rebases due to a conflict. Too bad we don't have tests for
tab-complete. Will fix.

> Also, the commit add a new pgoutput option "sequences":
> 
> +                else if (strcmp(defel->defname, "sequences") == 0)
> +                {
> +                        if (sequences_option_given)
> +                                ereport(ERROR,
> +                                                (errcode(ERRCODE_SYNTAX_ERROR),
> +                                                 errmsg("conflicting
> or redundant options")));
> +                        sequences_option_given = true;
> +
> +                        data->sequences = defGetBoolean(defel);
> +                }
> 
> But as far as I read changes, there is no use of this option, and this
> code is not tested. Can we remove it or is it for upcoming changes?
> 

pgoutput_sequence uses this

	if (!data->sequences)
		return;

This was inspired by what we do for logical messages, but maybe there's
an argument we don't need this, considering we have "sequence" action
and that a sequence has to be added to the publication. I don't think
there's any future patch relying on this (and it could add it back, if
needed).

regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Commits

  1. Fix cache invalidation bug in recovery_prefetch.

  2. Revert "Logical decoding of sequences"

  3. Minor improvements in sequence decoding code and docs

  4. Handle sequences in preprocess_pubobj_list

  5. Update tab-completion for CREATE PUBLICATION with sequences

  6. Add decoding of sequences to built-in replication

  7. Stabilize test_decoding touching with sequences

  8. Call ReorderBufferProcessXid from sequence_decode

  9. Add decoding of sequences to test_decoding

  10. Replace Test::More plans with done_testing

  11. Logical decoding of sequences

  12. Respect permissions within logical replication.