Re: Logical Replication of sequences

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Euler Taveira <euler(at)eulerto(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Hou, Zhijie/侯 志杰 <houzj(dot)fnst(at)fujitsu(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Subject: Re: Logical Replication of sequences
Date: 2024-12-23 07:20:14
Message-ID: CALDaNm0FqKMqOdm7tNoT5KgK1BAMeeVnOXrSJ2024TscAbf4Og@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 18 Dec 2024 at 11:40, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Vignesh,
>
> Here are some review comments for the patch v20241211-0002.
> ~~~
>
> publish option effect fro SEQUENCE replication?
>
> 2.
> It's not obvious to me if the SEQUENCE replication stuff is affected
> but the setting of pubactions (ie the 'publish' option). I'm thinking
> that probably anything to do with SEQUENCEs may no be considered a DML
> operation, but if that is true it might be better to explicitly say
> so.
>
> Also, we might need to include a test to show even if publish='' that
> the SEQUENCE synchronization is not affected.

Since we just synchronize the data and we don't replicate incremental
changes and insert/update/delete are only for incremental data sync, I
felt we need not mention this explicitly in this case as we have
mentioned that "Incremental sequence changes are not replicated" in
0005 patch. I also felt that there was no need to add a testcase for
this as currently it has nothing to do with this option.

>
> ======
> src/backend/commands/publicationcmds.c
>
> CreatePublication:
>
> 3.
> - /* FOR ALL TABLES requires superuser */
> - if (stmt->for_all_tables && !superuser())
> + /* FOR ALL TABLES or FOR ALL SEQUENCES requires superuser */
> + if ((stmt->for_all_tables || stmt->for_all_sequences) && !superuser())
> ereport(ERROR,
> (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> - errmsg("must be superuser to create FOR ALL TABLES publication")));
> + errmsg("must be superuser to create a %s publication",
> + stmt->for_all_tables ? "FOR ALL TABLES" :
> + "FOR ALL SEQUENCES")));
>
> It seems a quirk that if FOR ALL TABLES and FOR ALL SEQUENCES are
> specified at the same time then you would only get the "FOR ALL
> TABLES" error, but maybe that is OK?

I have modified the error message slightly

> ~~~
>
> AlterPublicationOwner_internal:
>
> 4.
> Ditto quirk as commented above, but maybe it is OK.

I have modified the error message slightly

The rest of the comments are fixed. Also the comments from [1] are fixed.
The attached v202412123 version patch has the changes for the same.

[1] - https://www.postgresql.org/message-id/CAHut%2BPsk1V2eUL_nreWp1trO1iSDqhDtBnfu65PrsoorpuNzKA%40mail.gmail.com

Regards,
Vignesh

Attachment Content-Type Size
v202412123-0003-Reorganize-tablesync-Code-and-Introduce-s.patch text/x-patch 23.5 KB
v202412123-0002-Introduce-ALL-SEQUENCES-support-for-Postg.patch text/x-patch 106.3 KB
v202412123-0001-Introduce-pg_sequence_state-function-for-.patch text/x-patch 7.4 KB
v202412123-0005-Documentation-for-sequence-synchronizatio.patch text/x-patch 23.1 KB
v202412123-0004-Enhance-sequence-synchronization-during-s.patch text/x-patch 89.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-12-23 07:22:28 Re: Logical Replication of sequences
Previous Message Corey Huinker 2024-12-23 07:15:01 Re: Additional comments around need_escapes in pg_parse_json()