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 1w2pr8-000ePx-0O for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Mar 2026 12:18:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2pr6-00AQJF-23 for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Mar 2026 12:18:32 +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 1w2pr6-00AQJ7-1C for pgsql-bugs@lists.postgresql.org; Wed, 18 Mar 2026 12:18:32 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2pr3-00000000M03-0mpi for pgsql-bugs@lists.postgresql.org; Wed, 18 Mar 2026 12:18:31 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4853c3c2fe7so3535455e9.0 for ; Wed, 18 Mar 2026 05:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773836309; x=1774441109; darn=lists.postgresql.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=5ZCK/NRWwjO6rAAePajuHWySUIMq6Phmyi0hUD5tf2k=; b=VX0oV8cGeLxNxNQaV95aO5W0Tp/jdn+N40mxSaQVnA9dDGtZiDCV7lgCj2Pzb+aE9s UTyevv7NGXozgH3ae9gNAREIFbpQlgqIGq/xJxwqPRrcMAhj/teht+VS7rz3qUUYastT /lWSR1ORyB/di+OptyEpQVXypUispQiIxjd4ZhAnSwmEECwmNGSPmwyT5VeGrbDFq7HJ z+kGnKPQRpvq+XJ+kRjCyftLc0vOHpicxHrKaYy6ynvIIbWlR5EIpyPPQ5E7ngpFqKJr QlFQ19UgwcFDVTJLGpr7RxoKxJI9QTWTN4Nf8sTJWQC3Ch3PdwR/UNhUJjJ6wPLkDK9A /g3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773836309; x=1774441109; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5ZCK/NRWwjO6rAAePajuHWySUIMq6Phmyi0hUD5tf2k=; b=BQNmEmlanjNTrPWZBnbHt5veVBNC81NiKcME6GrB8MbmGKyyqqF3M7nUZ/thMVs1Dz z3LRov4sAyAMujMrXiRblzszX89fdBSx7ISmDL54m4OWaBfDRPHmZImZI1MwkRIU4V3o sS8sFgbDsYv/aVLlwlsQdIS83o0hlAt5NjOY8ZGR3QWsFjOoA1ikqs7zgdhgFN+VQ3Gi ZEaTxFaKcNI49YLDB+iMpUGy4jiSiEgkkr/GnCkN19hWyTngNK0RHth44pl8l0lJ9m8B IT5lF2we8OTIdjpa3WVsjWzSE9lDn0scAMGrdY4vsgeo11zKzjwlamyBhRMFlk7F6B2z KNXw== X-Forwarded-Encrypted: i=1; AJvYcCXYoq1rFzzmNc93jRFESClRaFStKv7XIgTlDsuusXX5lDF3UIhpW1CZTbC9cW7PrQCecArtKzilLbc0@lists.postgresql.org X-Gm-Message-State: AOJu0YzKu4g8FgnPWR2wihlmJqPKD/Tfpl3QuUYx1/uNWcngyH88w4Ch XZZrp5eZGAewPUGdcoZw5e4CwkkLVKfAU1KF/+s4s1/lNxYr/EuAd9Ph X-Gm-Gg: ATEYQzyVVPcx+NVAQKw2dpI3BpTZHml4/K6mo017Wmq9yBjub0L+2sLSyh+VYItur+T YdlCMeCOvlH1ymY+BuXJNYxYFC2J7ftKNTMGrneTh3m2WxMWEgRNzxfw0REnF3wp7BqHQYaWsJp nh1CSLNUNNiGvUfFcEDMPSx492LuXMYQgPQgOYsEPUDo21noLrlXFj/Fee99TGuiCMvVUcUOqu0 W9bB0+qPcZvo0FI2XZVSyIxm8f8KqyxPs5BX2hh6mnupCH35PsOLJhQ3DTN5u6QO7XH5Mjb4upY KXLQ0Cb8OqotAhEEyfXgnvHQd+DbDSp/qDIrFIc/mnt15G49zjD6Jd+ttp0xgM9ldonjPz0L9/n OcLDLOG6pOk1k3O/l6jVVyVCi7ptFtf2qfQTCxT5bBMYQtcwpibpMpkNYjV96omft6qGdlFgFZ8 reRSD/3sF/QOBgsjB4OrG/BtL7ATcB61Yb/lP1pw== X-Received: by 2002:a05:600c:4703:b0:485:b6dd:5066 with SMTP id 5b1f17b1804b1-486f4421c64mr54072275e9.7.1773836309146; Wed, 18 Mar 2026 05:18:29 -0700 (PDT) Received: from [192.168.15.192] ([80.251.191.198]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4856ea97af2sm129633375e9.4.2026.03.18.05.18.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Mar 2026 05:18:28 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------0OpaIW5Q4ecghJND0MCyYshF" Message-ID: Date: Wed, 18 Mar 2026 13:18:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables To: Alexander Korotkov , Tender Wang Cc: Kirill Reshke , Fujii Masao , ammmkilo@163.com, pgsql-bugs@lists.postgresql.org References: <19435-3cc1a87f291129f1@postgresql.org> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------0OpaIW5Q4ecghJND0MCyYshF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 18/3/26 09:40, Alexander Korotkov wrote: > What about being more generic and call ChangeVarNodes_walker() for the > node in ChangeVarNodesWalkExpression()? It also works with out case > and avoids code duplication. I’ve reached the same conclusion. We lost a possible case when the RestrictInfo→clause contains a bare Var that isn’t pushed into either the left or right subtree. I think we can fix this by replacing the expression walker with ChangeVarNodes_walker(). 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. -- regards, Andrei Lepikhov, pgEdge --------------0OpaIW5Q4ecghJND0MCyYshF Content-Type: text/plain; charset=UTF-8; name="fix.diff" Content-Disposition: attachment; filename="fix.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL3Jld3JpdGUvcmV3cml0ZU1hbmlwLmMgYi9zcmMv YmFja2VuZC9yZXdyaXRlL3Jld3JpdGVNYW5pcC5jCmluZGV4IGZlODk3NTRhNzNjLi42MTBl ZGYxMDI4NCAxMDA2NDQKLS0tIGEvc3JjL2JhY2tlbmQvcmV3cml0ZS9yZXdyaXRlTWFuaXAu YworKysgYi9zcmMvYmFja2VuZC9yZXdyaXRlL3Jld3JpdGVNYW5pcC5jCkBAIC03NDQsOSAr NzQ0LDcgQEAgQ2hhbmdlVmFyTm9kZXMoTm9kZSAqbm9kZSwgaW50IHJ0X2luZGV4LCBpbnQg bmV3X2luZGV4LCBpbnQgc3VibGV2ZWxzX3VwKQogYm9vbAogQ2hhbmdlVmFyTm9kZXNXYWxr RXhwcmVzc2lvbihOb2RlICpub2RlLCBDaGFuZ2VWYXJOb2Rlc19jb250ZXh0ICpjb250ZXh0 KQogewotCXJldHVybiBleHByZXNzaW9uX3RyZWVfd2Fsa2VyKG5vZGUsCi0JCQkJCQkJCSAg Q2hhbmdlVmFyTm9kZXNfd2Fsa2VyLAotCQkJCQkJCQkgICh2b2lkICopIGNvbnRleHQpOwor CXJldHVybiBDaGFuZ2VWYXJOb2Rlc193YWxrZXIobm9kZSwgY29udGV4dCk7CiB9CiAKIC8q Cg== --------------0OpaIW5Q4ecghJND0MCyYshF--