Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wgzAu-006X6E-2L for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 06:20:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgzAs-004l7x-1L for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 06:20:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wgzAr-004l7i-3C for pgsql-hackers@lists.postgresql.org; Tue, 07 Jul 2026 06:20:54 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wgzAq-00000001y93-16Yf for pgsql-hackers@lists.postgresql.org; Tue, 07 Jul 2026 06:20:53 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-8efcef23d21so24824326d6.2 for ; Mon, 06 Jul 2026 23:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783405251; cv=none; d=google.com; s=arc-20260327; b=grN7bb47DLGCKSJdlHJiBleiGrspCsxyscOUA/NlFH94QiN5N3GxX+DtTmDFE5iU/W FA31tD7+nSgf8UDCbDOkjk2Ts080gdnEkky49+UT2sQrvCDo2nBo1S2VAtaACffdN3Yw KAcfw8JZ/Kv5DYXWL8aeZryKr+ewcNfa1JA8sX68A52DxMI7b40pRARc5o3m/6IBZK0f KYo8IAb6rLSL39cjTocBUD+151NDC0rOX0/NRo1R1m7mH+9eNy5w7igEfcFytjodzH5/ sET5mL01+sNE4bZZh6VsoJy3vV55HQNq/BQJpuQ3qBM9LwGzqa+aDiAb370by6/5Uqyj f3Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UQi350VscyzOb7XfQqFDK/IaXkuG16y/RwKrR4EvmrI=; fh=hxuXsAKJ8jWXvyX2RtCn5OfvMyXchPYQqU8qLXNYnZ8=; b=f0LP0hOUbRs39HBBVhrBymR8arAuLzncFpS9viIJqtjncGAIvJurQ6+iV4xViVwcOm dUExQi1NLCXh6KrPZ+AJhFnDpx7JOuxyzsBQ9WY5Nswfod/+9PRBmOdzPML/5HtB3mZY 1Eo+LPzMG7PTTduS5fQv6GrgHF9WbeY115vsAA8Um+CzeRtsvtYnau9UCpvK4raovPMA 1butgj2Oz0zU9nd2IWL8yxyS/KQJ/qo7BuKyxyk3llKpvH6Ybew1JjdYlzszgD2fBDx7 0yDrSYK8MK8zKVFuSP2GX3WTO0nK8g5Xk/S3Pz1I6r0bbJfNhUFH3yCZH6xTl7VOQ178 U03A==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783405251; x=1784010051; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UQi350VscyzOb7XfQqFDK/IaXkuG16y/RwKrR4EvmrI=; b=VQHC1QVR3T5UkfNQPhEQNYXDhp3pnzJCP5CoK6ZaWDpl94qIBuqp0AEGFyD4W/ljHe QVJ5SEy4XhW20UV/gUWPrizqgJUEY0E+h0ITDRI1MsaPoEZBC9gg37U6RThYKAN3hgla ykc2KZ6nGbGDdyQM58u7UVGDWcdwt45M84Yy2iBOk7iG1wezSQL1b9tBDU/ZMqqg41XC ViOtEjy+BqV/3OPnHs7NGGlL48zEdZXX4u4zVQRYCLMzEjaT3gpxeWeMRnhmNivJDvyb bHODhQA0FQ2JeHp79L4HrNKn9dp2HFZUlwVUpA83Emlqsb2gH7UF7U+h8XNepDFUQWSU T3RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783405251; x=1784010051; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UQi350VscyzOb7XfQqFDK/IaXkuG16y/RwKrR4EvmrI=; b=Ks8HBT9GFzR7SdmJoa3dbta8AA4hxEdPrm9vWxnAq8bXELbIhO8LRqH+Jw0BGni9Px th8gZ/V8EGHwBCtjH6riKxzlbhtL6tbeCFsR37hVQVC6WNEVHciw2+yL+Is0lNk0R+HG QJw5MYIIVuw73E+iA2H5/4Q8sF/L4qv5vmOW8pjXNYZfn87asQBbTHYhFj8qCbBYu2JR i4DILrw2A8TWjK97AP0+uUQSxbSw9THnXrge1Kuj9kEbsmmvQfYcABSnNa6m9LtD5LJK mCfjXVdbG8mW0JwnHEtVfRhJKypxMP3bzyNIkymHd5RZCOI9FyJe16fT9meY/KWWgI4w 6cbA== X-Forwarded-Encrypted: i=1; AHgh+RrB56s32Sq32LQ9aHnbhBXYzzUxVX/ktz2wZJGZ3hF7133Lqc3gOcVxsUSIjcPbaXXu02NyNUiYwmlCPjds@lists.postgresql.org X-Gm-Message-State: AOJu0YwLEgVCPdwJmKy44BYp1WHf0Kf8gzvFPEe+h1e5hyWQcZ2gFe3t 86WyP01+KsybU156l3mfkhzloRY6tW3uGqGg1afqyrrFyL+tHA10sGtxEKjhxVjVtcfnC9apLVE Tr4SDtB9R/1NEf28GZoFebbEKF1MHk+Q= X-Gm-Gg: AfdE7cmaqSyWWD2kpy1/VAucKLncOrrBdnJHok4ZfKD/ijlwktdowUeliRWFZom0BoP ESL5zGSqP4UAluRL4LErr1l71r1YnPIC0NIogqtDIrJjV7UcjhDmntJB4N0DDLL6S7HUDZtWFxs fiNeLUEYvo2ULnwK6dbFKdMyx7KDEozt9IwIQ7bNypKSeaEzPiw28Pa0wt5a2D8sJvbbibE59xu ZzIPlcOpu6JUQJM/hI2gHh6Yz4fPFQT3XF8T6hB6SFuV/t7A7AN1Ha76cKS4XVaztDzB59AwSsB E4YYjfGZDD+bij6aELDmoC22xBzoyNVka5ph3v5ky2a23iZStCEMBg== X-Received: by 2002:a05:6214:2e49:b0:8dd:4979:4b19 with SMTP id 6a1803df08f44-8fcb289c3f5mr52548436d6.13.1783405251094; Mon, 06 Jul 2026 23:20:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Tue, 7 Jul 2026 16:20:23 +1000 X-Gm-Features: AVVi8CchPSKUpBz6-EyvXylrqbbkgLhlqGj9m2xvv8nS7AhUJjE_-t2FjLkmjzA Message-ID: Subject: Re: Include sequences in publications created by pg_createsubscriber To: Shlok Kyal Cc: vignesh C , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Shlok. Although I'd previously said "v6 LGTM", I decided to feed the v7 patch through my AI to see what else it might come up with. It got a bit pedantic, but OTOH the suggestions really *do* seem like improvements to me, so I feel obliged to pass them on. =3D=3D=3D=3D=3D=3D doc/src/sgml/ref/pg_createsubscriber.sgml 1. + replica from a physical standby server. By default, + pg_createsubscriber configures + logical replication by + automatically creating internal publication and subscription objects. I= n + this mode, a publication and subscription are created for each database= , and + the publications include all tables and sequences in their respective + databases. "In this mode" is vague =E2=80=94 consider "When using internally generated publications," to be consistent with the terminology used later in the same paragraph. ~~~ 2. + which ensures each table is brought up to a synchronized state. When us= ing + internally generated publications, they automatically include all seque= nces + in the database; however, their values are not automatically synchroniz= ed. "they" is ambiguous =E2=80=94 could refer to publications or sequences. Suggest: "however, sequence values are not automatically synchronized." ~~~ 3. + For user-specified publications, sequences are only replicated if they = were + explicitly added to those publications prior to running the tool, and l= ike + the default mode, their values will require manual synchronization afte= r the + upgrade. "their values will require manual synchronization" =E2=80=94 "will require"= is slightly awkward. Suggest "their values must be manually synchronized after the upgrade." Also "like the default mode" is a slightly informal comparison =E2=80=94 consider "as with the default mode." ~~~ 4. + + To synchronize sequence values, run + + ALTER SUBSCRIPTION ... REFRESH SEQUENCES. + ``` This is quite abrupt as a standalone paragraph. It doesn't say *when* to run it or *which* subscription to run it against. Something like: "To synchronize sequence values after the upgrade, run `ALTER SUBSCRIPTION ... REFRESH SEQUENCES` on each subscription at the target server." ~~~ 5. + specified, pg_createsubscriber creates a + publication using + FOR ALL TABLES and + + ALL SEQUENCES. Otherwise, it uses the + user-specified publication, which includes the objects defined by th= at + publication. If the option is not + specified, the publication has the following name pattern: SUGGESTION avoid repeating --publication by rearranging like below: Create a publication and replication slot for each specified database on the source server. If the option is specified, the user-specified publication is used, which includes the objects defined by that publication. Otherwise, pg_createsubscriber creates a publication using FOR ALL TABLES and ALL SEQUENCES. This generated publication has the following name pattern: pg_createsubscriber_%u_%x (parameter: database oid, random int). =3D=3D=3D=3D=3D=3D src/bin/pg_basebackup/t/040_pg_createsubscriber.pl 6. +$result =3D $node_p->safe_psql($db2, + "SELECT puballtables, puballsequences FROM pg_publication"); +is($result, qq(t|t), + "publication is created with both all-tables and all-sequences enabled"); 6a. The query has no WHERE clause =E2=80=94 if there are multiple publicati= ons it could return multiple rows and give a misleading result. Should filter by publication name, e.g. WHERE pubname LIKE 'pg_createsubscriber_%'. ~ 6b. Should there also be a test that verifies a user-specified publication is not modified (i.e. does not have ALL SEQUENCES added) when --publication is specified? That would give better coverage of the two code paths. =3D=3D=3D=3D=3D=3D GENERAL 7. The commit message says "Administrators can then run `ALTER SUBSCRIPTION ... REFRESH SEQUENCES` after the upgrade" but the documentation does not make this prominent enough. Given this is the key action administrators need to take, it deserves a more prominent note =E2=80=94 perhaps a `` or `` block rather than a brief standalone paragraph. (I think this is related with point 4) ~~~ 8. There is no mention anywhere in the patch of what happens to sequence values if the administrator forgets to run REFRESH SEQUENCES before promoting the subscriber. A note about the risk (duplicate key violations, incorrect nextval results) would make the documentation more complete and help administrators understand why this step matters. (Again, I think this is related with point 4) =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia