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 1w3aQo-001Mwj-1f for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Mar 2026 14:02:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3aQk-006U95-2g for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Mar 2026 14:02:27 +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 1w3aQk-006U8x-1m for pgsql-bugs@lists.postgresql.org; Fri, 20 Mar 2026 14:02:26 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3aQi-00000000B0C-44z2 for pgsql-bugs@lists.postgresql.org; Fri, 20 Mar 2026 14:02:25 +0000 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-354bc7c2c46so921862a91.0 for ; Fri, 20 Mar 2026 07:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774015344; cv=none; d=google.com; s=arc-20240605; b=AzCka2/8w6suAoV+fuw0Gx3cA5TFCevlVDf/xHLn5BBFki9CVvRvSwa3cWp5YORW1F 1IZ+RhS96CAEjRYwwNcmiSdcuXLzQ35m4oz/A6kVQEh3a5TgbiY4kPwSzlDvfF1qkJcS PJJGHwino7Yg2AlnMD/9iGZvgE6SKHyQQyApoUq19MtBinGHdSShhMNjGXLkOrxjhb// YKwimJscQk/t6I4ev4D1Gh71LxjlT8wZz1d9Li4rrjp9aU7HPR5yhFfO6qEgWv/AHk9o f2kEib9zJLRuJV72oabfDfER1sNSLyj6nv0fZGyUCV+T7Moupcz/jvV4Avl+21U0tqjj EzEA== 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=AnHkahgitni8RogBungqEYaqmw2wJFC8CyNqZJpc5X8=; fh=RHQhAMkLtY+toZdyop7o1wImkG6gRLUd2jD4ro8iB8I=; b=WbCQf9x3FFs1f6WqwjK15zjopnUIemEC/dcVh2m45gxtGBS/qrXIK5wx4HA402aJEU 1TACgwiH1K+Df64LuM7YFA+meoeR4KEFagHa5Gykv2Vltn2Cr674YjTLwiwCcAzZPlD/ CQByCApUoLwzDzTIvpeptGYvgJYm7cKCcHqzAT2kxaH6U0XK1gBjIpuad3z/9V7one0B cGPRW13wNDYPcWDXEY/VRRpdSXm6yOzRto+HBPP1yPfdYRNK3ukgk2VAicGyf+XJP+Iw 3r0j7Dd97Qv4tQfl5oAnB0dgcbIr1h1p5hjoOX0duu5VNdtqHfaj0mPN3o+hGtbGauc/ fz5g==; 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=20230601; t=1774015344; x=1774620144; 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=AnHkahgitni8RogBungqEYaqmw2wJFC8CyNqZJpc5X8=; b=LxP9g3EmfwEO6hnX1IPaEdkTAMrI1isc8405LGYmVMdIJ7bEiKnO6AHP6jVePN7gPU uXs2HzmDCIZoJQOGZeLeo493RL8H2VefoQkdqdM9fGS6w4zMhmm+pwCY3jf9i9TVFEi/ 1EPLmci1ig3vpsj53tlueQy4psqTHInKuerBnsau7eoxMKaI3UMkWaRHzo+Is1CcYa+q qM3DoE38r0ujJ/iqxwE73HCUkYWAsP5ig8Puk9QvSaSrjw7fiBs+Qe/V2hX1MEYJGmqb YJlw9LfvhbNkCJZt4LFSfiPkCnfGgeY/i7E7Qxn4Ett4abZVd7d7a41qYxJ5PC+gk2Q+ 79vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774015344; x=1774620144; 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=AnHkahgitni8RogBungqEYaqmw2wJFC8CyNqZJpc5X8=; b=ZLbRqaU+3ZsCgvYrqs5y6zpnwMN369hJFxn1odRPwzAh5w99xNRfUawpLU9gV4BCHP n0IQVMX0mDGAco2J4sqmeAmLYQDsvbRiHy0Xje44Cm9Iv6zaHkszm8zrC20uEeztK15v eheqAHOleZFwfR3PQ0wiPFvEEaZnQYRXHxj0KPMtxK2FYFbt8F/GeSIEN8ca6AaEcfKG zbUehAbGxfyVozk/rKN0EitMb+BKVAjNsXNwOIEOym7p4ZyBSlFfpgzolDXozIdwHS5c dkpd+Y8+aTDfDEWocYKjs89o+XaTOiXslNl56Fb82R3A000lYOuk27mdlDeD1/NkSvQ+ 902w== X-Forwarded-Encrypted: i=1; AJvYcCXu1hBGBQv9yQVq7RRpLs76R1MnATAWg9JwO459yfABCCP8sNYsGVLJnQl1yHi3o97JYt2Kv3M8Aur4@lists.postgresql.org X-Gm-Message-State: AOJu0Yxe+j7ZZRx+x5SnQdT0HgwBXZDeKvq3PX8nh2qQ8aPJIXyW1tbL FUsxRkAEM+uIRY60f3mqIBcyTEy6bCv01E2/o3JJmYRJJb4+R9v/W4XqI8qB+xp5kcm0W5J73T6 EtsvxVa7fqaDzAmYtMJ23CJr83npkOGc= X-Gm-Gg: ATEYQzyFk/DtFdIqD4TV6fjEtsyIahSBLFkL2KdEsiv0ot0JjvFrbAU4VLvNR6aB5Lz Uf7iU4TenDnL7zsPhs4ETzUkTDX8ZcMWweNvDD/VWhIpI5wSV2j1jEspSuEIdKQvpZ62szmmgn3 fSxjU+gqpDlb5oxtwhHzY7Au/O6Rvp91dWPf0Ng05H8Kcgm7Kveq+x4ESTzz53DXbp0W5ByQjJ4 Fmy/c3lRfp9EYCI2UckM3ptwdS3jKGW45b68GPFCJPmepYInUqUWH67f+UepHTkydCyxpNFtw2J GaeRkS6y6cl7SPMsZaBz/zCakAiRCPHiK3Fxs2ivSZ0SyqpTiHGvCkSODCRI5TKupg0LRm1a1h3 +zvl2HtD5n/OXtJdUnm3zxZ1iOr8J8S4Ar7IcHD+J X-Received: by 2002:a17:90a:d408:b0:35b:945d:752a with SMTP id 98e67ed59e1d1-35bd2c6effamr2053666a91.17.1774015343322; Fri, 20 Mar 2026 07:02:23 -0700 (PDT) MIME-Version: 1.0 References: <19435-3cc1a87f291129f1@postgresql.org> <5a039d60-d13b-4cf0-a807-9c7269f06831@gmail.com> In-Reply-To: From: Alexander Korotkov Date: Fri, 20 Mar 2026 16:02:10 +0200 X-Gm-Features: AaiRm52xMM1MG1sjnCYc23OHgf11-3-M8JjGRFaJ8stG4ObNKy-_ExgS_h-7xE8 Message-ID: Subject: Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables To: Andrei Lepikhov Cc: Kirill Reshke , Tender Wang , Fujii Masao , ammmkilo@163.com, pgsql-bugs@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 Thu, Mar 19, 2026 at 3:03=E2=80=AFPM Alexander Korotkov wrote: > On Thu, Mar 19, 2026 at 9:18=E2=80=AFAM Andrei Lepikhov wrote: > > On 18/3/26 18:55, Kirill Reshke wrote: > > > On Wed, 18 Mar 2026 at 18:31, Andrei Lepikhov wro= te: > > >> > > >> On 18/3/26 13:21, Alexander Korotkov wrote: > > >>> On Wed, Mar 18, 2026 at 2:18=E2=80=AFPM Andrei Lepikhov wrote: > > >>>> What is the reason for the second change? Tender, can you show us = how to > > >>>> reproduce the issue so we can support your update to > > >>>> restrict_infos_logically_equal? If we include it, we should add a = test. > > >>> > > >>> I think Tender already shown this in [1]. The same qual is present > > >>> twice in the plan. > > >> Got it. I suggest making this a separate commit to keep the history > > >> clear. Let me share a draft with a test case for the bug fix first. > > > Hi! > > > Is `cool_bool` a typo of `col_bool` in regression test ? > > > > This is actually a happy coincidence, not a typo. We made this mistake > > during initial development because I didn't realise that a boolean > > operation on a bool variable is never wrapped in an expression > > structure. It's a 'cool' example that shows a rare edge case. > > > > > And the patch seems to have forgotten to add "Reported by". > > > > Yeah, let the committer manage the award part. > > I've revised the patch. Renamed cool_bool to cool_col, added > "Reported by", and revised authors list according to my opinion. OK. I've pushed this. Let's go back to restrict_infos_logically_equal(). I'm still not convinced that we need to check if required_relids is singleton. Why we can ignore outer_relids for singleton, but can't do if, for instance, two relations involved? ------ Regards, Alexander Korotkov Supabase