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 1w2TVD-000K1J-30 for pgsql-bugs@arkaria.postgresql.org; Tue, 17 Mar 2026 12:26:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2TVC-0018we-2g for pgsql-bugs@arkaria.postgresql.org; Tue, 17 Mar 2026 12:26:26 +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 1w2TVC-0018wV-1j for pgsql-bugs@lists.postgresql.org; Tue, 17 Mar 2026 12:26:26 +0000 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2TV9-00000000BNz-0l87 for pgsql-bugs@lists.postgresql.org; Tue, 17 Mar 2026 12:26:25 +0000 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-67ba5b0e00dso1580081eaf.2 for ; Tue, 17 Mar 2026 05:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773750384; cv=none; d=google.com; s=arc-20240605; b=WUbl7Ncihz9jbYLr9HJ/JmSMpV96/wgv/b+5kLCm5WJkDB6y0QpSCIDJyDx0h54bDX +pVskhRIwEBb5Z4kYInr2pssHQPy+2G5CgRu4uLv6tOKI7lJi609y9Tm/qTo+GJsJa0O LU7miv9Z7fmoJWD99DPHgGolTWxfJPRvZg2WB5NXT+bFIKS2/hZqAl5mo+ZucGv1rmZw 8UbiCLIiADpWbguZ0y6a288pUhHoMFqTylQV9R+pB3kRWT3IJbLj3se7vImpeCRPtONX YnmUrwC1WTEy+RmkrmiJ7WSPp/Ys16dAFausb5E+7AuyALE0Qa45ivSgKM5DtcJKhDZB /9Rg== 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=rbUNLgHNjNam8OP2q41mZqAy1xgkborKmLbf4r7+ZNE=; fh=DVdlrEY74qSPP4D6kiPUUyhvo5F7+Jg/1FrLQL5bS5o=; b=ThaCYaUGmXgJ3iLVzLf2DyQgwq/7hue/Phblz/CmGALfRBHxuaSugCvufMWtN2U1Qv oyAPePfkTTbhpdbFf0NmFs+R1hjNI9BvMx74Sgh70//ePH40nUcndmzJW5XKHcMuxhTX 3QnL87uF1duxLyZ1cPpf2ozcirivVA/NnuzWazdByhE59W+RkPYw8Gwrho4QOliysfq7 +1qY456UD6Pt67KiJiO/xng9veQJ1C5JpMLLfYOn6XCGOs1GVCQwKsr/6WUSnATLmU3z 9sP+1fMYrfpk/nq3qUumFvlthOJ6DFCID5jXSxntGqU/Yu4UgMXHAKW1nT6JPhLwWtpF t00g==; 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=1773750384; x=1774355184; 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=rbUNLgHNjNam8OP2q41mZqAy1xgkborKmLbf4r7+ZNE=; b=UE5YstnnmR98AwcjDqdb2QyYVItzXH8Bkd/rOus4yljyXThCjXKtstEhoF3Nxy4M+J niTvgKcT3sHCL5ZIOOKrMK2T5QaV3xNbUQ4hBE19I7WkdOY+sdbVfC4ojToADgL+3/eD 6ISQwKB5MzujWPe1OMSmJOxIkxDO9x323Na1ztf5idcVF4eHLZLUSF3f35H+YnaeP7yy DZ/H/2j7U6J8XKEZoU2IWKv9UBG5OaQP+BMI+DHi4z4kQATHBjF9haRmsBIz8YbmQZ9G riNfJeRx1Ij2m4j8GrY6tgeOvQkwF5qMqsdChvTH93IDPUOttwgLtqRcdgw2qcxfGjwD jRAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773750384; x=1774355184; 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=rbUNLgHNjNam8OP2q41mZqAy1xgkborKmLbf4r7+ZNE=; b=A3sL0vPqgMBhWZ+127fUAcWWYCEFUDlghSXxSBeUqrfMCJl6e89QwSsUr3GUuMIMgJ CU1Hl2UgHmF/r4i8/Zc7YGpYzUJf/OsvQTKhailAlG5PRYn7zZTElO+b9dpQihkrhWPs 9wzC5Ta6mlQWw8bpuqBvPy6rWvBLJ+9+Zmo6CHKPe/E6GFny9Ma1evwwCRDR3WsXay0+ JbzALnPM6knW43o+pRgtg3wzqHmr7Ii1s4h80wYS9yPd9GJTobTyjRW877ZDxJ25ZYlg uWo3j3o7GMySn+yLl6y1/zGnDEp2x6sYCskKhix3d55gii/OlciPmoL3X+cYKEOPlEB2 9YLA== X-Forwarded-Encrypted: i=1; AJvYcCX5pFj0DbDlQfHYu8qnp8jMJIm3Q9szstZlIqhDhu5/ZJk+2izy1LSD8tQRSedvr5OZah7fjHiB28YL@lists.postgresql.org X-Gm-Message-State: AOJu0Yxqwf1mffoL+0Opv/lRustxtNkH8Q/DrVXoXfgNfB1qMJjYANPO vOIDXbOVCLVDDD3S1tUjy38DOSaO7tSePeEaYQfRNPs02hscOiVAHJD3fSgVJew/PJ/5aYyBo46 0+NEOW2gOnxtom/IeA840JHqqasyBuaY= X-Gm-Gg: ATEYQzy2MALhCEddp4IL+7DyNrwHeJkuyh2/Shxa3Dkc+KrM3FRfp8WEbtXFl5VhDMy WgOHxEe6cB2aM77DRovBKoDal/8s1oT3R9t1n1wG8aXiQPwqqsVDrEvOEWgdVxuJAp0Aln4FAE4 JaS2XM6qEAf5WJdQ4nuSA0KxCUSHW+oM9Iza/LH5Mf735/tHz9/7So7JkjqwGYc6Pcs9XkBcqVy u1nj184kFyFyGpx/5rdyIK+iIeUDQEr9xiR73XU2B09hG2UMOY6w9YNeXhxT6xBQUZAtcUo3kRQ Z8WI/bVmh2zubccqbHnDQ1/CDmid3272MoVEOvM+K63UO+xScsthBRKi9mMJiUr2e6/e9GIb+TS oUrU= X-Received: by 2002:a05:6820:4df9:b0:67b:aef9:1ce5 with SMTP id 006d021491bc7-67bdaa2db8fmr10515768eaf.46.1773750383994; Tue, 17 Mar 2026 05:26:23 -0700 (PDT) MIME-Version: 1.0 References: <19435-3cc1a87f291129f1@postgresql.org> In-Reply-To: From: Alexander Korotkov Date: Tue, 17 Mar 2026 14:26:12 +0200 X-Gm-Features: AaiRm526V198R4W0M1xQdaj8KGahPMRcjHosibRWMFXmjdmvghJR3ieE3Y0r6bk Message-ID: Subject: Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables To: Fujii Masao Cc: 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 Tue, Mar 17, 2026 at 2:14=E2=80=AFPM Fujii Masao = wrote: > > On Tue, Mar 17, 2026 at 7:34=E2=80=AFPM PG Bug reporting form > wrote: > > > > The following bug has been logged on the website: > > > > Bug reference: 19435 > > Logged by: Hang ammmkilo > > Email address: ammmkilo@163.com > > PostgreSQL version: 18.3 > > Operating system: Ubuntu 22.04 > > Description: > > > > A user encountered an error when attempting to execute a query involvin= g > > multiple RIGHT JOIN operations and a NATURAL JOIN on the same table > > (pg_table_a). The error message returned was: > > [XX000]ERROR: no relation entry for relid 2 > > This error seems to be an internal one and should not be triggered by u= sers. > > It might be a bug. > > ```sql > > DROP TABLE IF EXISTS pg_table_a; > > > > CREATE TABLE pg_table_a ( > > id INTEGER PRIMARY KEY, > > col_bool BOOLEAN > > ); > > > > INSERT INTO pg_table_a (id, col_bool) > > VALUES (5, TRUE); > > > > SELECT 1 AS c1 > > FROM ( > > pg_table_a AS tom0 > > RIGHT JOIN ( > > (pg_table_a AS tom1 NATURAL JOIN pg_table_a AS tom2) > > RIGHT JOIN pg_table_a AS tom3 > > ON tom1.col_bool IS NOT NULL > > ) > > ON tom1.col_bool > > ); > > ``` > > Thanks for the report! > > I was able to reproduce this issue on the master. git bisect that I ran p= ointed > to commit fc069a3a631 as the likely cause. So I've CC'd its committer, > Alexander, on this thread. Thank you for adding me to the thread. I'm lookin at this. ------ Regards, Alexander Korotkov Supabase