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.98.2) (envelope-from ) id 1xLNHg-00000001Tyy-18iE for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Oct 2026 16:10:52 +0000 Received: from localhost ([127.0.0.1]:41896 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xLNHf-00000006bjs-3BO7 for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Oct 2026 16:10:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:54364) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xLNHf-00000006bje-2BPz for pgsql-bugs@lists.postgresql.org; Mon, 26 Oct 2026 16:10:51 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xLNHd-000000012iI-3Rkz for pgsql-bugs@lists.postgresql.org; Mon, 26 Oct 2026 16:10:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 69QGAkn7638643; Mon, 26 Oct 2026 12:10:46 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 sss.pgh.pa.us 69QGAkn7638643 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sss.pgh.pa.us; s=default; t=1793031046; bh=q+3S/FSX78vyqff1FuLR6X279P9bKcCbt1pFxMXZgok=; h=From:To:cc:Subject:In-reply-to:References:Date:From; b=AhHfVQ7yIN46yFmvHrahJ31G6RXwAU206rm+ev4b7q/qjrXXnS4iUlduqDcb/vvYB 5jvh4du0k9SqQw3OmJHXfDF9959gbHxmbge/drOGOdM/KDTksJml2v8iEupypeVmjx CSqVsCrX9InyiPuerAEFGVNu/2JCf4wmdXzRpXMo= From: Tom Lane To: Nitin Motiani cc: Dilip Kumar , alpkeles99@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19761: btree_gist: "cannot subtract infinite dates" when inserting 'infinity' into a GiST index on date In-reply-to: References: <19761-b72cfc453e487610@postgresql.org> Comments: In-reply-to Nitin Motiani message dated "Sun, 25 Oct 2026 17:05:39 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <638641.1793031046.1@sss.pgh.pa.us> Date: Mon, 26 Oct 2026 12:10:46 -0400 Message-ID: <638642.1793031046@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nitin Motiani writes: > Thanks for the review, Dilip. I'm attaching the v2 patch which makes > the change in date_dist also. I think this is not there yet. An important behavior of the corresponding code for float8 (float_penalty_num_impl()) is that it makes the distance between two same-sign infinity values be zero, not infinity. This is mathematically wrong but we must do it for indexing purposes, else inserting multiple infinities will end up splitting each infinity onto its own index page when we want all identical infinities to pack onto as few index pages as possible. BTW, while checking this I happened to notice that gbt_float8_dist has a variant of the same problem: r = arg1 - arg2; if (unlikely(isinf(r)) && !isinf(arg1) && !isinf(arg2)) float_overflow_error(); I don't think we want an error thrown there either; returning the infinite distance (or DBL_MAX?) seems better. regards, tom lane