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 1q8OUG-0004L6-1j for pgsql-bugs@arkaria.postgresql.org; Sun, 11 Jun 2023 17:04:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q8OTF-00086f-NB for pgsql-bugs@arkaria.postgresql.org; Sun, 11 Jun 2023 17:03:17 +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 1q8OTF-00086W-Em for pgsql-bugs@lists.postgresql.org; Sun, 11 Jun 2023 17:03:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q8OT8-001dnK-Qx for pgsql-bugs@lists.postgresql.org; Sun, 11 Jun 2023 17:03:16 +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 35BH366e836413; Sun, 11 Jun 2023 13:03:06 -0400 From: Tom Lane To: exclusion@gmail.com cc: Tomas Vondra , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17969: Assert failed in bloom_init() when false_positive_rate = 0.25 In-reply-to: <17969-a6c54de48026d694@postgresql.org> References: <17969-a6c54de48026d694@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Sun, 11 Jun 2023 15:00:01 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <836411.1686502986.1@sss.pgh.pa.us> Date: Sun, 11 Jun 2023 13:03:06 -0400 Message-ID: <836412.1686502986@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: > The following script: > CREATE TABLE tbl (i int); > CREATE INDEX idx ON tbl USING brin (i int4_bloom_ops(false_positive_rate = > 0.25)); > INSERT INTO tbl VALUES(1); > triggers an assertion failure: > TRAP: failed Assert("(false_positive_rate >= BLOOM_MIN_FALSE_POSITIVE_RATE) > && (false_positive_rate < BLOOM_MAX_FALSE_POSITIVE_RATE)"), File: > "brin_bloom.c", Line: 282, PID: 1062784 > Reproduced starting from 77b88cd1b. Hmph. Surely that should read "false_positive_rate <= BLOOM_MAX_FALSE_POSITIVE_RATE" ? > Maybe that Assert is not needed at all... Seems a little excessive to me too, given the comment near the #define that the range limits are pretty arbitrary. Perhaps what would be suitable is "Assert(false_positive_rate > 0 && false_positive_rate < 1)" to show that we don't need to check for failure of the subsequent log() call, and that the log() must be negative so that the nbits result will be sane. regards, tom lane