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 1tHIg5-005l59-TV for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 08:18:09 +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 1tHIg3-00Eamo-De for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 08:18:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tH4Wz-009BMh-6R for pgsql-hackers@lists.postgresql.org; Fri, 29 Nov 2024 17:11:50 +0000 Received: from vserv.cifnet.com ([208.76.170.74]) by makus.postgresql.org with esmtps (TLS1.0) tls TLS_RSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1tH4Wx-000C4y-8Q for pgsql-hackers@postgresql.org; Fri, 29 Nov 2024 17:11:48 +0000 Received: from LU-NOTEBOOK ([37.232.161.105]) (authenticated bits=0) by vserv.cifnet.com (8.13.8/8.13.8) with ESMTP id 4ATHBeld017899 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 29 Nov 2024 11:11:44 -0600 (CST) (envelope-from pgsql-hackers@dima.nikitin.name) Date: Fri, 29 Nov 2024 20:11:34 +0300 From: Dmitry Nikitin Reply-To: Dmitry Nikitin Message-ID: <582986626.20241129201134@dima.nikitin.name> X-Confirm-Reading-To: pgsql-hackers@dima.nikitin.name Disposition-Notification-To: pgsql-hackers@dima.nikitin.name Return-Receipt-To: pgsql-hackers@dima.nikitin.name To: pgsql-hackers@postgresql.org Subject: Unclear code - please elaborate MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello , https://github.com/postgres/postgres/blob/5d39becf8ba0080c98fee4b63575552f6800b012/src/backend/optimizer/prep/prepjointree.c#L3856 bms_next_member() is allowed to return the zero as a valid value. Subsequent rt_fetch() offsets that zero to -1 which leads to the assertion down the code. Nothing wrong here? Either zero is simply not possible after that bms_next_member() because of some factors behind the code? -- Best regards, Dmitry mailto:pgsql-hackers@dima.nikitin.name