Re: Crash in BRIN minmax-multi indexes
Zhihong Yu <zyu@yugabyte.com>
From: Zhihong Yu <zyu@yugabyte.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Jaime Casanova <jcasanov@systemguards.com.ec>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-04-01T13:31:31Z
Lists: pgsql-hackers
Hi, Tomas: Thanks for the correction. I think switching to interval_cmp_value() would be better (with a comment explaining why). Cheers On Thu, Apr 1, 2021 at 6:23 AM Tomas Vondra <tomas.vondra@enterprisedb.com> wrote: > On 4/1/21 3:09 PM, Zhihong Yu wrote: > > Hi, > > Can you try this patch ? > > > > Thanks > > > > diff --git a/src/backend/access/brin/brin_minmax_multi.c > > b/src/backend/access/brin/brin_minmax_multi.c > > index 70109960e8..25d6d2e274 100644 > > --- a/src/backend/access/brin/brin_minmax_multi.c > > +++ b/src/backend/access/brin/brin_minmax_multi.c > > @@ -2161,7 +2161,7 @@ > brin_minmax_multi_distance_interval(PG_FUNCTION_ARGS) > > delta = 24L * 3600L * delta; > > > > /* and add the time part */ > > - delta += result->time / (float8) 1000000.0; > > + delta += (result->time + result->zone * USECS_PER_SEC) / (float8) > > 1000000.0; > > > > That won't work, because Interval does not have a "zone" field, so this > won't even compile. > > The problem is that interval comparisons convert the value using 30 days > per month (see interval_cmp_value), but the formula in this function > uses 31. So either we can tweak that (seems to fix it for me), or maybe > just switch to interval_cmp_value directly. > > regards > > -- > Tomas Vondra > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company >
Commits
-
Fix assert in BRIN build_distances
- 02699bc1fd3b 16.0 landed
- c4f64cfab9fe 15.2 landed
- 883dc0214a64 14.7 landed
-
Fix bug in brin_minmax_multi_union
- d9c5b9a9eeb9 14.0 landed
-
Fix order of parameters in BRIN minmax-multi calls
- 1dad2a5ea3d1 14.0 landed
-
Fix BRIN minmax-multi distance for inet type
- e1fbe1181c86 14.0 landed
-
Fix BRIN minmax-multi distance for timetz type
- 7262f2421a1e 14.0 landed
-
Fix BRIN minmax-multi distance for interval type
- 2b10e0e3c2ca 14.0 landed