pgsql: Fix BRIN minmax-multi distance for interval type - Mailing list pgsql-committers

From Tomas Vondra
Subject pgsql: Fix BRIN minmax-multi distance for interval type
Date
Msg-id E1lT6RE-0003xA-Pf@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix BRIN minmax-multi distance for interval type

The distance calculation for interval type was treating months as having
31 days, which is inconsistent with the interval comparator (using 30
days). Due to this it was possible to get negative distance (b-a) when
(a<b), trigerring an assert.

Fixed by adopting the same logic as interval_cmp_value.

Reported-by: Jaime Casanova
Discussion: https://postgr.es/m/CAJKUy5jKH0Xhneau2mNftNPtTy-BVgQfXc8zQkEvRvBHfeUThQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2b10e0e3c2ca14d732521479123e5d5e2094e143

Modified Files
--------------
src/backend/access/brin/brin_minmax_multi.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Improve psql's behavior when the editor is exited without saving
Next
From: Tomas Vondra
Date:
Subject: pgsql: Fix BRIN minmax-multi distance for timetz type