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 1pPmRp-0000hw-ED for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Feb 2023 15:33:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pPmRn-0004xz-M4 for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Feb 2023 15:33:23 +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 <9erthalion6@gmail.com>) id 1pPmRn-0004xf-Be for pgsql-bugs@lists.postgresql.org; Wed, 08 Feb 2023 15:33:23 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1pPmRh-0007Ry-Ec for pgsql-bugs@lists.postgresql.org; Wed, 08 Feb 2023 15:33:22 +0000 Received: by mail-ed1-x529.google.com with SMTP id eq11so20976818edb.6 for ; Wed, 08 Feb 2023 07:33:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=U5QB4M5NDRjEAUaOzu2J2Jyq+pEtQMt2AE9R4ll0weY=; b=M4Y+xu40UPHm+UNdvY00nVpPmsMIhRD4RQw2XJscwDY+qmBHzUOR7aS7YCEZfE9SuX 2OWfJdI5FDJDXxaBwKdOnwiytreaCTsaOW11wMglaa5es5UyhqHiroM724BzQaA3luic A6Vm783UMZmHH/LGdoMHOe4mdhs+Ev4BbJI6Yiv/lJ3knqjETV4QolC7TJzZkFXXV0p+ 0r90cg8hXOR3hHxZs0IzVYmQEQPWzKJQEfG1nZ7VSxYzEqaoNKlZ9LWJT++9zCwcW2cP WTswRHydgldjwqDIx52RggTcfKIFRZ9fWYY43hf44ow91MC82pYdzan8MJhO6idb6EzU Y8zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=U5QB4M5NDRjEAUaOzu2J2Jyq+pEtQMt2AE9R4ll0weY=; b=v9hzWH2N9SGSCknj4zcZBIWFSThVDUIzRPTKAO1pDxOae2TNJJ8YngZfCj09O4pzbv 7kaNU5eItste/m4X9iRZ9oKF7zktWeRLjiQ4vBkdlM4yIc2iNcohBdNxot45V4Z8mHwK csPFAi0HOb+nyPkZD2HJU3ngdAA8vWgCyQqywPcydAIoxWb6hIj4dGF5fiWyi0AIzrzV wfGARSbNXEgCEFMpGnuoIrKDWo7IDdFnh7adPuBQcklVmNeagwGqxLzVmwZh3X/L2hHf yoOJx+9c7fRf2wffoUEZ8ikz/4RltqanKzqhnM4Tve7OzJ6m62cTFbAegejy1IFmumZm yQrg== X-Gm-Message-State: AO0yUKXhD9xB2qgF7KI6g+Ic47XwH0uOAoIRVSjC5t3oxwthgx8EbIvH EPraev/rOKWGZdcgjI55C0w= X-Google-Smtp-Source: AK7set+kaCJRP4BSyVBa2ZlOc6WzKbVPsBhtwmhNW/xTHQZuy6mpEV9TUfwbkmeIPJttGFHR4AYbrA== X-Received: by 2002:a50:d6d9:0:b0:499:b48b:2c3 with SMTP id l25-20020a50d6d9000000b00499b48b02c3mr8370152edj.25.1675870394825; Wed, 08 Feb 2023 07:33:14 -0800 (PST) Received: from ddolgov.remote.csb (dslb-178-012-041-046.178.012.pools.vodafone-ip.de. [178.12.41.46]) by smtp.gmail.com with ESMTPSA id c21-20020a056402101500b004a2440f0150sm7913320edu.97.2023.02.08.07.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 07:33:14 -0800 (PST) Date: Wed, 8 Feb 2023 16:33:13 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Tom Lane Cc: John Naylor , tharakan@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17774: Assert triggered on brin_minmax_multi.c Message-ID: <20230208153313.fym7at3ubgrec67a@ddolgov.remote.csb> References: <17774-c6f3e36dd4471e67@postgresql.org> <20230208100658.mz2kkeruoma6iqtw@ddolgov.remote.csb> <3485884.1675868581@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3485884.1675868581@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Wed, Feb 08, 2023 at 10:03:01AM -0500, Tom Lane wrote: > 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. Hmm...yeah, good point. In both the reproducer I've posted and the backtrace from the thread the delta is indeed rather small.