Re: Logical Replication of sequences

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(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>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Subject: Re: Logical Replication of sequences
Date: 2025-07-20 14:15:13
Message-ID: CALDaNm2swnY6nYAg==7-4ah3yyaBQ_5wyr57p=+vtpfuSOT+ag@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 18 Jul 2025 at 16:15, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Thu, Jul 17, 2025 at 4:52 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > The attached v20250717 version patch has the changes for the same.
> >
>
> Few comments on 0001 and 0002:
> 0001
> 1. Instead of introducing a new function, can we think of extending
> the existing function pg_get_sequence_data()?

Yes, this can be extended. Modified.

> 0002
> 2.
> postgres=# Create publication pub2 for all tables, sequences;
> CREATE PUBLICATION
> ...
> postgres=# Create publication pub3 for all tables, all sequences;
> ERROR: syntax error at or near "all"
> LINE 1: Create publication pub3 for all tables, all sequences;
>
> I was expecting first syntax to give ERROR and second to work. I have
> given this comment in my earlier email[1]. I see a follow up response
> by Nisha indicating that she agreed with it [2]. By any chance, did
> you people misunderstood and implemented the reverse of what I asked?

This was a misunderstanding here. Updated accordingly.

> 3.
> postgres=> Create publication pub3 for all tables, sequences;
> ERROR: must be superuser to create a FOR ALL TABLES publication
>
> In the above, the publication is both FOR ALL TABLES and ALL
> SEQUENCES. Won't it be better to give a message like: "must be
> superuser to create a FOR ALL TABLES OR ALL SEQUENCES publication"? I
> think we can give this same message in cases where publication is (a)
> FOR ALL TABLES, (b) FOR ALL SEQUENCES, or (c) FOR ALL TABLES,
> SEQUENCES.

Modified

> Whatever we decide here, we can follow that in other parts of the
> patch (where applicable) as well. For example, one case is as below:
> + if (!superuser_arg(newOwnerId))
> + {
> + if (form->puballtables)
> + ereport(ERROR,
> + errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> + errmsg("permission denied to change owner of publication \"%s\"",
> + NameStr(form->pubname)),
> + errhint("The owner of a FOR ALL TABLES publication must be a superuser."));
> + if (form->puballsequences)
> + ereport(ERROR,
> + errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> + errmsg("permission denied to change owner of publication \"%s\"",
> + NameStr(form->pubname)),
> + errhint("The owner of a FOR ALL SEQUENCES publication must be a superuser."));

Modified here too.

The attached v20250720 version patch has the changes for the same.

Regards,
Vignesh

Attachment Content-Type Size
v20250720-0001-Enhance-pg_get_sequence_data-function.patch text/x-patch 7.2 KB
v20250720-0005-New-worker-for-sequence-synchronization-du.patch text/x-patch 75.7 KB
v20250720-0003-Reorganize-tablesync-Code-and-Introduce-sy.patch text/x-patch 25.4 KB
v20250720-0004-Introduce-REFRESH-PUBLICATION-SEQUENCES-fo.patch text/x-patch 41.1 KB
v20250720-0002-Introduce-ALL-SEQUENCES-support-for-Postgr.patch text/x-patch 105.4 KB
v20250720-0006-Documentation-for-sequence-synchronization.patch text/x-patch 33.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-07-20 14:18:42 Re: Logical Replication of sequences
Previous Message Frédéric Yhuel 2025-07-20 13:54:49 Re: Metadata and record block access stats for indexes