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 1pPlyX-0007gm-Cm for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Feb 2023 15:03:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pPlyV-0002IA-T2 for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Feb 2023 15:03:07 +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 1pPlyV-0002Hz-L5 for pgsql-bugs@lists.postgresql.org; Wed, 08 Feb 2023 15:03:07 +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 1pPlyS-00077G-QV for pgsql-bugs@lists.postgresql.org; Wed, 08 Feb 2023 15:03:06 +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 318F31Qd3485885; Wed, 8 Feb 2023 10:03:01 -0500 From: Tom Lane To: Dmitry Dolgov <9erthalion6@gmail.com> cc: John Naylor , tharakan@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17774: Assert triggered on brin_minmax_multi.c In-reply-to: <20230208100658.mz2kkeruoma6iqtw@ddolgov.remote.csb> References: <17774-c6f3e36dd4471e67@postgresql.org> <20230208100658.mz2kkeruoma6iqtw@ddolgov.remote.csb> Comments: In-reply-to Dmitry Dolgov <9erthalion6@gmail.com> message dated "Wed, 08 Feb 2023 11:06:58 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3485883.1675868581.1@sss.pgh.pa.us> Date: Wed, 08 Feb 2023 10:03:01 -0500 Message-ID: <3485884.1675868581@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dmitry Dolgov <9erthalion6@gmail.com> writes: > The negative delta might be only a consequence. From what I see it's > called from build_distances, and the idea is to find the gaps between > the max value of the current interval and the min value of the next one, > so they should be ordered and delta should be always positive. I'd believe this argument more readily if the calculation weren't being done in float arithmetic. Since it is, you're at the mercy of roundoff error ... and that small negative delta could certainly pass for roundoff error. Clamping the result to [0,1] would be a brighter plan than just asserting that it's in-range. regards, tom lane