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 1wFSY9-005916-2Y for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 08:03:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFSY7-00CNQM-0i for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 08:03:07 +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 1wFSY6-00CNQE-2y for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 08:03:06 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFSY1-00000002RGg-3CA0 for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 08:03:06 +0000 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-35fc2b18363so5840799a91.0 for ; Wed, 22 Apr 2026 01:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776844979; cv=none; d=google.com; s=arc-20240605; b=A86Bleteel35pKjOkPTcX39UWtE+aoXzW/t02XAEcm5loBUJKA5JzDzA3thlTP2pHd 2zxXlbSCyqaQv98YClfEP74CRQIaYAEE4KDs14v0ul5u3owphkHLIAMs5F79hutctpwT hwKrAu8VTDc+5KPiwArhHiNpzk1yFVzOz3wC2dFmLRmvhvHlvuXe0XidNtyXgOBZQCqF a5JGimQ5pJVmRf1fgg+4BwqV9iXWR6AhmDTKVvmeemfdF4DZNwwiJ+Y3s8d0NwBOBt1I Fg/7Bf7VmNvDUf89J1Df2OcYZu+LZL0bAnEL4iMU6V7dCbv10a7zwF3RX06SKqA+TK2d XJBA== 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=qbRWiWQX1qSMMCK7OCFkkJhQ5C5kvECfn82dkehDT8o=; fh=4aVuAGDt5Wdg7daw0dlfNa480FncP81TaW6shvIZrMg=; b=Wvb8o2HkUHcMJybJkAA/uNKEmCimAzrQJMtWbm0xFlghvq8GS8F5mnYX+JzymWSwZt mitZjqxGjhaxORJNqum5qC2QfpR10D5uBK+VDsk25CwYeA4pD7Y5FAm53NdnqP+zlHV7 8oKW4eMaqtI2dzb+b3LuMtONIBLFv4z8qDBSDJwjbKAP3T4Uk0Nl95uXIWxZnGDYPNZv FMaHUwVc63ctQVWFc+27r/3asmTEpeybCyAirpLXG5Z8xikfotJTMniMzOCzvmCI65PV a2oNwlyCm4Nx+lSkqNRdP8irg9qmTOMSpTY3FsYNuZ6jUXouJU0KVopCt9UnvPrTd3cX oSBg==; 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=1776844979; x=1777449779; 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=qbRWiWQX1qSMMCK7OCFkkJhQ5C5kvECfn82dkehDT8o=; b=L2jpyKdYjiU5mkiaRepJgiQCLfuAQc+rgvPlsAnDqSQfz91Sas4BlO4Na5Zk7cZnGw KxoejcSZT68o27+l7fzSo/tswIWhSWlXfHaihQmv3XEhRpp0AmlTJE8q4pesSOjPT8n/ 2/cAsrIQo12AlVQTHB6RYvrgibMXz1XDiOyH8THENAvdLhouq8cMNCDD2gTKB+0AUw7E xn/Y0AoagcMhPpokPy7lH7UektkuYphwnbFo149B/OCzaAxJjW/UZkrA5g7gQGeQGoWX Dq17sTaphEcWjZIZrU4KLmWq6MjULGW6yXVClHUde6b7kq1GP8JUbhCOjmMp9GsSyaFf tEKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776844979; x=1777449779; 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=qbRWiWQX1qSMMCK7OCFkkJhQ5C5kvECfn82dkehDT8o=; b=dO5qMyPlErQbo+BZv1+gCJ9OJ91rXPwcco4XAn72pxhpBGYnAoAzMcV9k6f35pJrJb wphu2ze1mKim7zzgjlY9pNm3Bk5nE7ArhGMuoalk/81hDRvjXuBxFVPzKwAFTJczP88t f4xfxRzhkdtKHUA6oXOmSdGreenSPn/F5KBXbMriTqsuTc6n1c4mwBmsaWBnEUBpqQXA YCim5uR6Wr/OD/KuDWHKQCK0jxoQMjgmUngUOycfHp/lxc8sCjgSXmdttvTMBrgDIybB M+DrzUT0bkO9S9aZSZGaqW2fttcS56g8mpALGg8Qb/cHlDEhrAdIuwAPWwDztJRQmDRM GApA== X-Forwarded-Encrypted: i=1; AFNElJ/lT5JR68xVt5MWrNVkQ45DgaNwt4gOx/KY0gXjN83b5CBxAVgzjYPVGr9DUTGCLWK2CVBHbxVx56cflDL6@lists.postgresql.org X-Gm-Message-State: AOJu0Yzjk6B0WsBeQTEmWBB97YeMYkdEqjtwROBu4A2PadkijSU6xq/w G7RcQVPMs8O6iCsFmFHIUWkNw2DAzdNg17VNcVm7SuhdLUubMv3GiIBeABwfJsMr8uu+YyPOTFH lXxH5OcTqaRHcQ1iGyKqWzqbvrkeoxl4= X-Gm-Gg: AeBDievHID9U69qALwszrzideatpmvvZQW+hpip7M06IQPuLZWyU8Q22GJQFwT1oo/0 4uRKCNu5KHXEU4cS5BB5TAxzCo6gXSc79C7vPli/BPZ4A1w6leO6j9t/ydStMkFBqW1fAkrAj3l Lv80zDad/rtZElggOuEL7/y0IKLdmkzpCtXKcinZDPNqFG+2VkLZ+mwYq8xDWIBHwRb/7b7/vTx h6StKSR0Ohuak/VoRWeLqRXl/3ODzYePhil3ya2F3RpkmuWK0NEwfk/wtqr8NnsR8uRRttR3kny ChpHshIn8rvw1dWpcR82S8vGMoPY3gNFRD2VD1ZpwKG0vSTBcZc= X-Received: by 2002:a17:90b:1804:b0:35d:9da0:4947 with SMTP id 98e67ed59e1d1-361403f15abmr22666115a91.11.1776844979081; Wed, 22 Apr 2026 01:02:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Wed, 22 Apr 2026 01:02:20 -0700 X-Gm-Features: AQROBzD-8SwKOY3mjXEmDi12G-ah2Mh_InwyDDeaChWHxMITSMK_Jbd8lTRe2BQ Message-ID: Subject: Re: Fix pg_upgrade to detect invalid logical replication slots on PG19 To: shveta malik Cc: Lakshmi N , "pgsql-hackers@lists.postgresql.org" 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 Tue, Apr 21, 2026 at 9:27=E2=80=AFPM shveta malik wrote: > > On Mon, Apr 20, 2026 at 2:28=E2=80=AFPM Lakshmi N wrote: > > > > Hi Hackers, > > > > The PG19-optimized slot catchup query uses a CTE that filters on > > invalidation_reason IS NULL, then cross-joins it with the main slot > > query. When ALL logical slots in a database are invalid, the CTE > > returns zero rows, and the cross join produces an empty result set. > > This causes pg_upgrade to silently skip those slots entirely -- > > neither detecting them as invalid (which should block the upgrade) > > nor attempting to migrate them. > > > > The pre-PG19 query path does not have this problem because it queries > > pg_replication_slots directly without a cross join. This may not impact > > upgrade to PG19 but will change the behavior for PG20 upgrade. Thank you for the report. > > > > Fix by changing the cross join to a LEFT JOIN, > > so that invalid slots still appear in the result set with NULL > > caught_up values. > > > > I agree with the problem here. I've confirmed the bug and the patch fixes it. The patch looks good to me, so I'm going to push it tomorrow barring any objections. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com