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 1q9bCZ-0007Hy-83 for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Jun 2023 00:51:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q9bCX-0008Lt-Sa for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Jun 2023 00:51:01 +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 1q9bCX-0008K7-Jv for pgsql-bugs@lists.postgresql.org; Thu, 15 Jun 2023 00:51:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q9bCV-002QsE-66 for pgsql-bugs@lists.postgresql.org; Thu, 15 Jun 2023 00:51:01 +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 35F0or1u2031446; Wed, 14 Jun 2023 20:50:53 -0400 From: Tom Lane To: David Rowley cc: Andres Freund , tel@jklm.no, pgsql-bugs@lists.postgresql.org, Peter Geoghegan Subject: Re: BUG #17975: Nested Loop Index Scan returning wrong result In-reply-to: References: <17975-98a90c156f25c952@postgresql.org> <20230614203651.hyc4cjdzhgrg3pav@awork3.anarazel.de> <20230614211231.pudg2y2rz6az2vij@awork3.anarazel.de> <20230614224928.l255k2okc3ms3iph@awork3.anarazel.de> <2020235.1686783768@sss.pgh.pa.us> <20230614235711.x2ffx54zi7mnt6ho@awork3.anarazel.de> <2026451.1686787166@sss.pgh.pa.us> <2029337.1686788900@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Thu, 15 Jun 2023 12:38:23 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2031444.1686790253.1@sss.pgh.pa.us> Date: Wed, 14 Jun 2023 20:50:53 -0400 Message-ID: <2031445.1686790253@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Thu, 15 Jun 2023 at 12:28, Tom Lane wrote: >> I concur that we'd better just not use partial indexes in >> relation_has_unique_index_for. > I wonder if that's ok for a backpatch. This affects both left join > removals and unique joins. Seems like suddenly making a left join > removal not work might cause someone some pain. I kind of doubt that this will affect any large number of users. If it did, we'd have had reports sooner. > Is it worth trying to jam in a new boolean field into IndexOptInfo > into some spare padding to that we run predicate_implied_by() just > using baserestrictinfo and use those in > relation_has_unique_index_for()? How will that work with the caching in innerrel_is_unique? I also seriously doubt that we can make such a thing work without adding parameters to any externally-visible functions. regards, tom lane