Thread

  1. RE: Logical Replication of sequences

    Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com> — 2025-10-14T12:09:16Z

    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