Re: Logical Replication of sequences

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(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-08-06 12:43:58
Message-ID: CABdArM7aY+u5Fv9KMHp_iX=AEixfDum5e2ixZkWS8YcOt_NO7Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 6, 2025 at 2:28 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
>
> The attached v20250806 version patch has the changes for the same.
>
Thank You for the patches.

patch-0005: sequencesync.c
+ aclresult = pg_class_aclcheck(RelationGetRelid(sequence_rel), GetUserId(),
+ ACL_UPDATE);
+ if (aclresult != ACLCHECK_OK)
+ aclcheck_error(aclresult,
+ get_relkind_objtype(sequence_rel->rd_rel->relkind),
+ seqname);

I see that the run_as_owner check has been removed from
LogicalRepSyncSequences() and added to copy_sequences() for the
SetSequence() call.

However, IIUC, the same check is also needed in
LogicalRepSyncSequences(). Currently, the sequencesync worker can fail
in the above permission check since user switching doesn’t happen when
run_as_owner is false.

```
ERROR: permission denied for sequence n1
```
Should we add the run_as_owner handling here as well to avoid this?

--
Thanks,
Nisha

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2025-08-06 13:10:55 Re: Skipping schema changes in publication
Previous Message John Naylor 2025-08-06 12:16:00 Re: cpluspluscheck vs ICU again