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 1wFaxU-005L5V-20 for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 17:01:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFaxT-00EVqB-2W for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 17:01:51 +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 1wFaxT-00EVq1-1b for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 17:01:51 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFaxL-00000002HYC-2JkJ for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 17:01:50 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-ba61a0a2d26so641551366b.2 for ; Wed, 22 Apr 2026 10:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776877302; cv=none; d=google.com; s=arc-20240605; b=Lo28FKFN7RqMpGSQnGpTxuqLip9gv8In7F04L1zi8iR54oBLi74z24rh/i5zmf57oB izwYVFRLvQmjR19ZULvyYi9oH6nmA7SksL02bvsK8ByK/PyoWCRJWJFRo7cVQ+TtcIxR rkrY4cYCKMQZWZeOKvTJE5GppA1XU8S8Vvybm8xmlAYYnQH7pBAmcxDuXTWHMK6TEnfN HgNNT1kovuS8qChVMzLiAAViwBeq6wWDC++mfijStammbp4Bk/dDP67wEoyaYTlffkK+ y9vnZR0atkD9O3lcm5oOhAN3V/0D8qHXrvQPETPTweVZgdQ5IoO42KqnT4nP73rE1Swy gr6g== 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=rwukrlfpcqjyCoH0YHT1zFrlPNLTE780DQn/JZB1HRc=; fh=wEnHO3OI8F6wDTj02ChM3Uglx/MQw8nhyJkrgsduBEo=; b=Jatao4c91V3+jfN47lpjGAZq6cs7wcc8WlpGCaf9LiaAjQVFfQyt3oIbXClYBdV4rb Fb59Guo/Z8oG2gxtgf/MiP/u7PdfS9QWaEiADb5vMiHtdZkQG95wHPWKLMh1pQTXDrU2 0YK/6+2zUtfE9YfCI9LGpTQOC4Yv+KyhrvgwrETS2Zfx/HdaH+RjyaBjsaIk+y38R98X EX+vTIVkaKKlApdfEwop0xM0UkSB2L6r+QHLr/TcHDYktvKFaYsV0ZXWbf0ju5iDj3iG 35FIBvpyrBPaZLS1HTMBIMl3VpxwalJPWd+FAu3wdxgp35N154bv2xzcd4J329GbwQsX +2oA==; 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=1776877302; x=1777482102; 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=rwukrlfpcqjyCoH0YHT1zFrlPNLTE780DQn/JZB1HRc=; b=N9N2DfILkwv7xGpZStXFpjJ3JYk3CJWfus/P8/TTlLLsRdENJjP5VnHq4RVy/+O2/C u7YPyRHqwR2bTBRS8CMT2SAB0lqNYmJwhptthUQyYdl8IdppDnq+lKU5k1W7wzC4NXoy tTQKDP1X8d5rzTY4edcfcyX/OpdfieLyubuIylAQePGa8nRSpTm083iQQWG6ZxbELeFz KrJFDfyFO0F7uB6H8RaE15vsffVsC6hB3JDR9lossxflrXW0HR4Il6+Q1s0+NN1peTNL uWVUZxz90K2gwztHAV/ZFCGxe8PzaUtVtvuut6v2kBp0s0DBIqyFIttzm1fsfhHKYMGx rLiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776877302; x=1777482102; 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=rwukrlfpcqjyCoH0YHT1zFrlPNLTE780DQn/JZB1HRc=; b=sO29oQ12e73BTyk7YKZ/xnOJN8K8JKS6EIYnyz8X4f36F0nZO4QYc2NWPZ15LahMAt tjt/z4eEpy0G2XFioFU91GefwVriNr8UZpS9BjY9Nktlw1hnCyyN1v99z6i9JO6F0Rqy g1j/xtAkYKTwv63JXXN8wUayI0ZR1NAy9d0tYE8OICyTlGiod4Hhff4QI4zHsB6abbYI NBA4tHxy8x+/XZumlsCI+Y6xdxqgfNh3vze/b4MottCvx5DQZE0JMo16kPKGKkTZnN+V FTF7qUyjUG/rH8i5G6lC9j6j97hQ5bYHkRP/+WLeF54p5AS9bgPm6PdehrfjRKFTKXbj EPhQ== X-Forwarded-Encrypted: i=1; AFNElJ8p+9BtZRAPOImXbKjTPHCc1c4oHbk5gyPq7+Hfj9py2zh49/DXN1n7QMLZnYtwf+G3Av8SChIbXxGk5gVB@lists.postgresql.org X-Gm-Message-State: AOJu0YyVExv7c54PMqfQSCDKrm1bbmwjLhhUvz1Fq1g3sggNvhEnA32o fcfl4qoomQzMmj4Ljm9dEkIsBp6P4dmuiN+ejkjTPuKL0f6CQLVxY/v2BUtsxP/2uG83zZ9K36f EWD2IwjEG3BZAv2tbCzCOmjfokeWNaQKBwYLP X-Gm-Gg: AeBDietrw4OlU/BTyryTUTW98LhMNROCQh+2+ZNCc3ksbAClp6Jw9BiMYAXKXxnIUxT tbc6e2Xzp0mTHcXOBI2sTDU1395YBsPtfbN+H0yphUXUpPyDW61M1JmzjfeEltb5D0kpxQPkRed twq+J+0ZvuwmEaCJR91QMTIKgQSEsZsVhOM9szTJuGXZ4au33ytVoqz/z3ce3Iv7+NSidJOkZaK FrF+saAZJaGUfkXZEY/bekMKvPIsQ05Z2oCS0mT4T7+nzGy2uSy/KUs/r0JuzVL/Hb9CIYYzwkl Gnwfrc1EOWzPrJ7uINZ7nCq7D0MhP3QlPUg+lnO0V7QcNCYl77w= X-Received: by 2002:a17:907:847:b0:b9d:fa94:3cf6 with SMTP id a640c23a62f3a-ba418e86cf1mr1185875966b.14.1776877302102; Wed, 22 Apr 2026 10:01:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Wed, 22 Apr 2026 10:01:01 -0700 X-Gm-Features: AQROBzBdqywXi05HoGCe2FD5VzwSLZD2HsIyR3CmUsq4bUMnw6dXkG8jprsGfEU 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 Wed, Apr 22, 2026 at 1:02=E2=80=AFAM Masahiko Sawada wrote: > > 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 impa= ct > > > 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. Pushed. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com