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 1wXcnS-003Ns4-1x for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 10:38:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXcnR-00FhDS-1G for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 10:38:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXcnR-00FhDK-08 for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2026 10:38:01 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXcnO-00000002Why-2pay for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2026 10:38:00 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-c86307c4e6bso1657676a12.0 for ; Thu, 11 Jun 2026 03:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781174276; cv=none; d=google.com; s=arc-20240605; b=lthrYhGWDCYUWsQwjqUq7xZ+Tr4nytALWBQWqryzYGksWmFlscSDqHgh6zBE88bQ3u +KYfHEwwrpiA0auEa/3Tn9nUyG/DQSIs4AHBYJnAqC3RMlaQo23jfGVLa1R0H2v+OFII 2k6phWHEqkujaGSFo/n51yCbpNhqrTvnq+87fCClphzmojcN0NCc+0LdJKZPKFq4Gqbh ruGtsebCjEM1tu46PgLviJx3N5Q8MjLnICOKe9R7nMk5AwMZxoyJY5OJQWcmDS5YkUr/ zcphBtGwtsVErqMfN2U6yqbHrfPgMsQhTMUQILADUjLAaHuLmkrSfSA8ciG746IeHDB0 Pxfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZWC8b1aqxJZPZve0SFGTsHeQQgoisHscrYZXkARvZ0A=; fh=ZHpOj2CSqNNeY5rdpcTttl/WgifnJhkoBQCXTD5Rkps=; b=j0AZyKys3j3LpMxjAa27Uvs3ewgXwoynmyoCU8dQj3Zy05KBagJ18O1d3oJZ+mdmzf e3iyDMWMtrPg1AXHfSUm5NsgLDkxBPI3xEbj9XYroc8HmxJBI4hgBvXyNsioZHHzFSap 7T1bQemt76fKfmeQsgFf++JpaDtlbP5PrBZ7inJgOHn6AKRjNhYnNNpdUT8hTmeE767Q UFLLu1QhJ02lCP4Rn7a93wY0psCNDFEbbHDiMVHssgrmvK0BvjnVhW6FxuiayjAJlNPa FRaPmN53a4lafuruiFMvrXpJkfsmmhfCP59ZzBypyoM60MkgClfto644FH7YktjdQctJ uWyQ==; 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=1781174276; x=1781779076; 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=ZWC8b1aqxJZPZve0SFGTsHeQQgoisHscrYZXkARvZ0A=; b=HRFND5diZSuEphAdCHzrDpt2+OvVnmhSoUNoVxQt9vkzsWuCm315gEqNnKmmATbdZW TsXXi00wU/rYu0YZ3I3T8HVJ766klp0aznX+kUOPDZ/aHxMZIr33y730zYjunI1nmkpL tXbVS3ZQKuRaKUw3Yb47+OgnBb4Io3mLUUORMjg9C9oKjDBh8lWQ3RTIyTqBBCluSVKr EdPmeOOIxJb8QYfuJisRzYKqapT2VFz0IvW6wH3EtOiuDKtIM9ZREobjRVOLezCPWfXN +NfLUuprXyFFN16xxn8W8RVBnJIaP4UvRm8Y3CAYxXox9jEwjQS/VVeIx8kl0ouMLpGA AGqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781174276; x=1781779076; 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=ZWC8b1aqxJZPZve0SFGTsHeQQgoisHscrYZXkARvZ0A=; b=kl3cvp9YFJRiLqqBGQF5B3mSP4f48HFCxwO8+4vr5jU9vUmGvKmRR+j2uwvzH9tEJz GqUFQFQt0D7UzotMlEKojBUa4Yx67T+1wdzrfBeLbmQeEFnczF9D+iCnqu4YJD+dHodD nO7KH+5u/V7RwblC3C7SPmC85N9gv19CH4vu1+/ZP670oaRhDVwJSIC6b/9Ey4MLqLbD VYzroitOkfJBVerliMjM99mk8A3euFMP9o4OJH7dSQSIFiMoHTNeSydZtPOgFfp3VHY7 yVXQkfep3ilALjMmxwixpeVvHB0MDqdEw3bxr0g7nvWsRvlZNxoyDcoJtlEVT0E6t/wn AyFA== X-Forwarded-Encrypted: i=1; AFNElJ8VqVazvMJYXIYi6grlZhXOZoagQIxPAeyxaFZmsQaF4L6E8ihzkXRq5LbxTOWGePSPcmdE9wgNRfL8uWT0@lists.postgresql.org X-Gm-Message-State: AOJu0YwbW8fmujAm5QMsekyuvooe4nKcmii+65ykZlg1qlP9smrhojIY Io29KOi97hiAAzHQ2O/KIoRiQh0HgXoAI3JcauhxzXrwpLcWMhL15IYveRoLH6JyqGlTzmfMfhU 2LTIy5/qHFVk1BcMfb/LNTyUGx6iOZKo= X-Gm-Gg: Acq92OH9BLRLeyWPyd/rnpARY4XyYCpuYFoNOwN0a8uYLG8q+qtPadLy7VbCRFoS7wc KhU1xyYTxJ1W9JW1ynadpCRI23ObSjCciJ3V/Oa+OZFoCn8tWSPyxFBsFr4c30aMW05viUL0lLE h/sKrZemIohVRfbCde8r7enEzbUgWwx1WooobEmnnVU1cKA1WSVGoL/Rn8THSzgq9qP2AegHDJk hSmFb2Is3MOVRSmtRNL5kiY0YnxuLXJxK3ijxLOMj3lM0u3dn8dEv7VCvCxT69NvO4HFNm7+WK2 FhmUqcMp2qxHfKBUMGeDcywEZFEfDaaVE4XBNitCvfzLg+OL71/vajHdDnQUkNgn2l9imXc+DzX OW93rVKeH/cvJfkkal/AD/XljmdO2tkk= X-Received: by 2002:a05:6a20:c5aa:b0:3b4:88e7:87c7 with SMTP id adf61e73a8af0-3b5e31dac0amr2272916637.17.1781174276022; Thu, 11 Jun 2026 03:37:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Thu, 11 Jun 2026 16:07:44 +0530 X-Gm-Features: AVVi8CewVFzqtbClPAk0yE1_AD4rTBFBXOfmW3GI_Csr5vzutqcO0zHKjEzMzpw Message-ID: Subject: Re: [PATCH] Preserve replication origin OIDs in pg_upgrade To: "Hayato Kuroda (Fujitsu)" Cc: Shlok Kyal , Amit Kapila , Dilip Kumar , Ajin Cherian , Zsolt Parragi , vignesh C , PostgreSQL Hackers , shveta malik 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 On Thu, Jun 11, 2026 at 12:22=E2=80=AFPM Hayato Kuroda (Fujitsu) wrote: > > Dear Shveta, > > > No, this difference is not expected. > > Yes it must be fixed. > > > 2) > > Another idea could be to have a > > 'binary_upgrade_skip_subs_origin_creation' variable. We populate it > > during dumpSubscription if 'source_version >=3D PG17' and > > 'IsBinaryUpgrade' is true. So this will be dumped > > > > SELECT pg_catalog.binary_upgrade_set_skip_subs_origin_creation(true); > > CREATE SUBSCRIPTION ... > > SELECT pg_catalog.binary_upgrade_set_skip_subs_origin_creation(false); > > > > First call will set 'binary_upgrade_skip_subs_origin_creation' which > > will be used by Create Subscription to decide to skip origin. This is > > similar to how dumpACl decides whether to record priveleges into > > 'pg_init_privs' for objectes created by extensions. See > > binary_upgrade_set_record_init_privs() which sets > > binary_upgrade_record_init_privs which is then used by > > recordExtensionInitPriv(). > > To clarify, I prefer the 2nd idea. According to 29d0a77, which migrates > replication slots from PG17+, it does not change the behavior when the so= urce is > PG16-. We should follow the manner. > > In case of third idea, origin id can be also preserved for PG16-, but the > version was out-of-scope of our patch [1]; in that version pg_subscriptio= n_rel > cannot be migrated, thus the logical replication cannot work in the first= place. I agree. > Also, if we want to keep the existing behavior, we should allow upgrading= the > below case. > > Source: PG16, two subscriptions and origins exist (id =3D 1, 2). > Target: an origin exists (id =3D 1) > > But we must reject upgrading if we preserves the origin-id, right? Right. That is why I commented that if we choose option3, we will need to implement the check (check_new_cluster_replication_origins) even on PG16 to reject the upgrade in the case you suggested. thanks Shveta