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 1tHQ4r-007HyV-8r for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 16:12:13 +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 1tHQ4n-000GvN-Bn for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 16:12:10 +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 1tHQ4n-000GvE-1z for pgsql-hackers@lists.postgresql.org; Sat, 30 Nov 2024 16:12:10 +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 1tHQ4k-000L2L-CY for pgsql-hackers@postgresql.org; Sat, 30 Nov 2024 16:12:09 +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 4AUGC1Ae918749; Sat, 30 Nov 2024 11:12:01 -0500 From: Tom Lane To: Dmitry Nikitin cc: pgsql-hackers@postgresql.org Subject: Re: Unclear code - please elaborate In-reply-to: <582986626.20241129201134@dima.nikitin.name> References: <582986626.20241129201134@dima.nikitin.name> Comments: In-reply-to Dmitry Nikitin message dated "Fri, 29 Nov 2024 20:11:34 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <918747.1732983121.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 30 Nov 2024 11:12:01 -0500 Message-ID: <918748.1732983121@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dmitry Nikitin writes: > https://github.com/postgres/postgres/blob/5d39becf8ba0080c98fee4b63575= 552f6800b012/src/backend/optimizer/prep/prepjointree.c#L3856 > bms_next_member() is allowed to return the zero as a valid value. Subseq= uent rt_fetch() offsets that > zero to -1 which leads to the assertion down the code. Nothing wrong her= e? Either zero is simply not > possible after that bms_next_member() because of some factors behind the= code? Zero isn't a valid relid. If we were to find such a value in that bitmapset, an assertion would be a fine outcome. regards, tom lane