Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJywM-0000iy-5C for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Aug 2022 15:08:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJywJ-0002kY-NW for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Aug 2022 15:08:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJywJ-0002e5-E7 for pgsql-bugs@lists.postgresql.org; Fri, 05 Aug 2022 15:08:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJywH-0002iQ-0a for pgsql-bugs@lists.postgresql.org; Fri, 05 Aug 2022 15:08:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 275F8R113943163; Fri, 5 Aug 2022 11:08:28 -0400 From: Tom Lane To: Richard Guo cc: Japin Li , Tomas Vondra , a.kozhemyakin@postgrespro.ru, PostgreSQL mailing lists Subject: Re: BUG #17570: Unrecognized node type for query with statistics on expressions In-reply-to: References: <17570-f2f2e0f4bccf0965@postgresql.org> <3508845.1659627758@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Fri, 05 Aug 2022 17:03:13 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3943161.1659712107.1@sss.pgh.pa.us> Date: Fri, 05 Aug 2022 11:08:27 -0400 Message-ID: <3943162.1659712107@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > I realized the fix in v2 is not correct. The attnums generated by > statext_is_compatible_clause is expected to be NOT offsetting by its > caller, i.e. statext_mcv_clauselist_selectivity. Revise that in v3 patch > by doing the offsetting when composing clause_attnums that need to have > permission check. Yeah, I was afraid that that route would require the patch to metastasize into more places. Agreed on keeping the argument definition the same and coping locally instead. But I don't think that you've done enough to address the root cause of this bug, which is the woeful under-documentation of the argument. I'll have a go at that part. regards, tom lane