RE: Logical Replication of sequences

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, 'vignesh C' <vignesh21(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(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>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
Subject: RE: Logical Replication of sequences
Date: 2025-10-14 12:09:16
Message-ID: OSCPR01MB14966B8BB27B784674506C9A8F5EBA@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Hou,

Thanks for updating the patch. Here are comments for recent 0002.
Others are still being reviewed

01. pg_subscription_rel.h
```
+#include "nodes/primnodes.h"
```

The inclusion is not needed because the

02. typedefs.list
```
+SubscriptionRelKind
```

Missing update.

03. subscritioncmds.c
```
+#include "catalog/pg_sequence.h"
```

I could build without the inclusion. Can you remove?

04. check_publications_origin
```
+
+ query = "SELECT DISTINCT P.pubname AS pubname\n"
+ "FROM pg_publication P,\n"
+ " LATERAL %s GPR\n"
...
```

pgindent does not like the notation. How aboout chaning the line after the "="?
I.e.,

```
query =
"SELECT DISTINCT P.pubname AS pubname\n"
"FROM pg_publication P,\n"
" LATERAL %s GPR\n"
...
```

05. AddSubscriptionRelState

```
if (HeapTupleIsValid(tup))
elog(ERROR, "subscription table %u in subscription %u already exists",
relid, subid);
```

Theoretically subid might be the sequence, right? Should we say "relation"
instead of "table" as well?

06. AlterSubscription_refresh_seq
```
+ /* Get local relation list. */
```

In contrast can we say "sequence"?

07. check_publications_origin
```
if (res->status != WALRCV_OK_TUPLES)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
errmsg("could not receive list of replicated tables from the publisher: %s",
res->err)));
```

Should we say "relations" instead of "tables"? Similar lines are:

```
/* Process tables. */
...
* Log a warning if the publisher has subscribed to the same table from
```

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-10-14 12:20:16 Re: get rid of RM_HEAP2_ID
Previous Message Dilip Kumar 2025-10-14 11:37:46 Re: Logical Replication of sequences