Re: btree_gin: Incorrect leftmost interval value - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: btree_gin: Incorrect leftmost interval value
Date
Msg-id 63b56dae-cfb6-4a84-ac8b-fd3a08ea1312@iki.fi
Whole thread Raw
In response to btree_gin: Incorrect leftmost interval value  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
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)




pgsql-hackers by date:

Previous
From: torikoshia
Date:
Subject: Re: RFC: Logging plan of the running query
Next
From: Étienne BERSAC
Date:
Subject: Re: RFC: Logging plan of the running query