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 1orMe9-000358-QP for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Nov 2022 17:07:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1orMe7-0001J0-Vd for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Nov 2022 17:07:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1orMe7-0001Il-NS for pgsql-bugs@lists.postgresql.org; Sat, 05 Nov 2022 17:07:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1orMe2-0005lq-OK for pgsql-bugs@lists.postgresql.org; Sat, 05 Nov 2022 17:07:47 +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 2A5H7iJV2616650; Sat, 5 Nov 2022 13:07:44 -0400 From: Tom Lane To: Richard Guo cc: Jeff Janes , sindysenorita@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17618: unnecessary filter column <> text even after adding index In-reply-to: References: <17618-7a2240bfaa7e84ae@postgresql.org> <349136.1663601052@sss.pgh.pa.us> <739953.1663701274@sss.pgh.pa.us> <946195.1663718159@sss.pgh.pa.us> <2100290.1663942209@sss.pgh.pa.us> <2174559.1663977891@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Wed, 02 Nov 2022 15:46:30 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2616648.1667668064.1@sss.pgh.pa.us> Date: Sat, 05 Nov 2022 13:07:44 -0400 Message-ID: <2616649.1667668064@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > Update with v3 patch, nothing changes except fixes a test failure > spotted by cfbot. I think this is pretty close to usable, except that I don't believe reusing simplify_boolean_equality this way is a great idea. It does more than we need (surely the LHS-is-Const case cannot occur here) and it has assumptions that I'm not sure hold --- particularly the bit about !constisnull. I'd be inclined to just copy-and-paste the three or four lines we need. regards, tom lane