Re: btree_gin: Incorrect leftmost interval value

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: btree_gin: Incorrect leftmost interval value
Date: 2023-10-27 12:42:52
Message-ID: 63b56dae-cfb6-4a84-ac8b-fd3a08ea1312@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Étienne BERSAC 2023-10-27 12:54:48 Re: RFC: Logging plan of the running query
Previous Message torikoshia 2023-10-27 12:30:02 Re: RFC: Logging plan of the running query