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.94.2) (envelope-from ) id 1qxIFN-00HR6G-HI for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Oct 2023 02:43:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qxIFL-00AVL3-H4 for pgsql-bugs@arkaria.postgresql.org; Mon, 30 Oct 2023 02:43:19 +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.94.2) (envelope-from ) id 1qxIFL-00AVKv-4y for pgsql-bugs@lists.postgresql.org; Mon, 30 Oct 2023 02:43:19 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qxIFI-003kuN-Km for pgsql-bugs@lists.postgresql.org; Mon, 30 Oct 2023 02:43:18 +0000 Received: from [192.168.1.35] (cm-171-100-241-215.revip10.asianet.co.th [171.100.241.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.lepikhov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 96232E203E9; Mon, 30 Oct 2023 05:43:13 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1698633795; bh=FKqycbOBf8Qw8sbnLijC1EVzPrML9db3mxAtWTsEM4Y=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=uvzTLypGyBAKongDIGb4bPGAtzmQvgA4DJd7vjsgJ2lItNBgwixIl8zywvYRbKoA0 of3kIzfbmZO/tYtWfWOHFQtDaVyCvVuMZAAVGctCVvVvBoXA/eDI1DjqoQHdxlWtj7 6ROOso1BGI2QDMbHg21gVcZNMIq/h4k6A+VKmrFAfxFprtrIlQEmBxG2XmlRHOvZIp /szE1enEqZMDJazINdwjG++OB8MLiq+oDfOSE1OBIc5Mxc4gCQKeL4k3LND88kuVPy ruhxzZZ5cBxtu0RuINtarvvPPE9uBx8lRiEHmUWvYW0fkCVNxuBdJew5oM+MxPtgep 33VWtw3Bk/tMA== Message-ID: <99b66244-f939-49ea-b6bf-ecf0440694b7@postgrespro.ru> Date: Mon, 30 Oct 2023 09:43:09 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #18170: Unexpected error: no relation entry for relid 3 To: Tom Lane , Alexander Korotkov Cc: Richard Guo , Vik Fearing , zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org, Alexander Korotkov References: <18170-f1d17bf9a0d58b24@postgresql.org> <4ecab120-6be3-4cf6-a2a0-249c73ae91d4@postgresfriends.org> <1189851.1698340331@sss.pgh.pa.us> <011bcae5-7840-42c7-a50c-b406189e2e78@postgrespro.ru> <721542ce-79df-469e-93e9-811fadb5bd0c@postgrespro.ru> <2eb87c2e-7e6f-4002-8df3-8fac3aa6a037@postgrespro.ru> <2141583.1698595016@sss.pgh.pa.us> Content-Language: en-US From: Andrei Lepikhov Organization: Postgres Professional In-Reply-To: <2141583.1698595016@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 29/10/2023 22:56, Tom Lane wrote: > Alexander Korotkov writes: >> I made some beautification of the patch by Andrei. I also removed the >> part which changes the target list for estimate_num_groups(). Any >> objections to pushing this? > > It seems moderately likely that this will break as much as it fixes. > > I've not studied the original patch enough to understand why you need > to be playing strange games with tree mutation rules, but I suspect > that this is band-aiding over some rather fundamentally bad code. Thank you for the feedback. I need to confess that it is not clear why keeping two links on the same query in a consistent state is a bad idea. If it really is, it would be better for future development to explain the reason as a comment in the code (because the current problematic procedure was introduced only in [1]). The doubt I had had about SJE was the cleaning procedure. We are afraid of hidden corner cases when deleting relid can be placed elsewhere, or a new feature could add more places for this relid. But as an opposite reason, we have a better understanding of the planner, a kind of self-check of hidden potential bugs. And for me personally, the latter is a strong reason. Also, as I see, in the e9a20e4 you wrote the code keeping in mind the same idea. [1] Make Vars be outer-join-aware -- regards, Andrei Lepikhov Postgres Professional