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 1oJczu-0000iD-G1 for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Aug 2022 15:42:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJczs-0007s9-03 for pgsql-bugs@arkaria.postgresql.org; Thu, 04 Aug 2022 15:42:52 +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 1oJczr-0007qs-Nj for pgsql-bugs@lists.postgresql.org; Thu, 04 Aug 2022 15:42:51 +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 1oJczm-0001no-PU for pgsql-bugs@lists.postgresql.org; Thu, 04 Aug 2022 15:42:48 +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 274FgcPA3508846; Thu, 4 Aug 2022 11:42:38 -0400 From: Tom Lane To: Japin Li cc: Tomas Vondra , Richard Guo , a.kozhemyakin@postgrespro.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17570: Unrecognized node type for query with statistics on expressions In-reply-to: References: <17570-f2f2e0f4bccf0965@postgresql.org> Comments: In-reply-to Japin Li message dated "Thu, 04 Aug 2022 22:59:07 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3508844.1659627758.1@sss.pgh.pa.us> Date: Thu, 04 Aug 2022 11:42:38 -0400 Message-ID: <3508845.1659627758@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Japin Li writes: > Attached to new patch add a test-case from Alexander Kozhemyakin. It appears to me that this is actually very thoroughly broken. * statext_is_compatible_clause_internal is not on board with offsetting the attnums. * Neither is this check for a whole-row reference (line 1628, in HEAD): if (bms_is_member(InvalidAttrNumber, clause_attnums)) * Although the coverage report claims this code is exercised, the fact that nothing failed when you made only a partial fix says it's not exercised well enough. * The comments for statext_is_compatible_clause suck. If they'd defined what the arguments are, perhaps this mess would have been prevented. For extra credit, it'd be really nice to define what "is compatible" means. I'd sure not have thought that that would include permissions checks. regards, tom lane