public inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Dean Rasheed <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Re: btree_gin: Incorrect leftmost interval value
Date: Fri, 27 Oct 2023 15:42:52 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEZATCV80+gOfF8ehNUUfaKBZgZMDfCfL-g1HhWGb6kC3rpDfw@mail.gmail.com>
References: <CAEZATCV80+gOfF8ehNUUfaKBZgZMDfCfL-g1HhWGb6kC3rpDfw@mail.gmail.com>

On 27/10/2023 12:26, Dean Rasheed wrote:
> In contrib/btree_gin, leftmostvalue_interval() does this:
> 
> leftmostvalue_interval(void)
> {
>      Interval   *v = palloc(sizeof(Interval));
> 
>      v->time = DT_NOBEGIN;
>      v->day = 0;
>      v->month = 0;
>      return IntervalPGetDatum(v);
> }
> 
> which is a long way short of the minimum possible interval value.

Good catch!

> Attached is a patch fixing this by setting all the fields to their
> minimum values, which is guaranteed to be less than any other
> interval.

LGTM. I wish extractQuery could return "leftmost" more explicitly, so 
that we didn't need to construct these leftmost values. But I don't 
think that's supported by the current extractQuery interface.

-- 
Heikki Linnakangas
Neon (https://neon.tech)







view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: btree_gin: Incorrect leftmost interval value
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox