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 1sNH2q-007has-2c for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Jun 2024 19:14:04 +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 1sNH2o-006TMu-9s for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Jun 2024 19:14:02 +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 1sNH2o-006TMm-19 for pgsql-bugs@lists.postgresql.org; Fri, 28 Jun 2024 19:14:02 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sNH2h-0042Ke-NM for pgsql-bugs@lists.postgresql.org; Fri, 28 Jun 2024 19:14: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 45SJDrbA2002051; Fri, 28 Jun 2024 15:13:53 -0400 From: Tom Lane To: feliphepozzer@gmail.com cc: pgsql-bugs@lists.postgresql.org, Richard Guo Subject: Re: BUG #18526: 'UPDATE' inconsistency using index scan with 'NOT EXIST' after upgrading to PostgreSQL 16 In-reply-to: <18526-bf89f27cb20d8a18@postgresql.org> References: <18526-bf89f27cb20d8a18@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 28 Jun 2024 17:24:32 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2002049.1719602033.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 28 Jun 2024 15:13:53 -0400 Message-ID: <2002050.1719602033@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > Expected Result: All records that meet the criteria should be updated > regardless of using index scan or seq scan. > Actual Result: When PostgreSQL 16 uses index scan, it fails to find and > update all records. By changing random_page_cost to a value that forces = the > use of seq scan, all records are updated correctly. I see that the problematic plan involves a Merge Right Anti Join step, which makes me guess that this is the same bug recently reported in https://www.postgresql.org/message-id/flat/18522-c7a8956126afdfd0%40postgr= esql.org Are you in a position to try the patch posted in that thread? regards, tom lane