Skip to content

Commit 7262f24

Browse files
committed
Fix BRIN minmax-multi distance for timetz type
The distance calculation ignored the time zone, so the result of (b-a) might have ended negative even if (b > a). Fixed by considering the time zone difference. Reported-by: Jaime Casanova Discussion: https://postgr.es/m/CAJKUy5jLZFLCxyxfT%3DMfK5mtPfSzHA1rVLowR-j4RRsFVvKm7A%40mail.gmail.com
1 parent 2b10e0e commit 7262f24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/access/brin/brin_minmax_multi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2090,7 +2090,7 @@ brin_minmax_multi_distance_timetz(PG_FUNCTION_ARGS)
20902090
TimeTzADT *ta = PG_GETARG_TIMETZADT_P(0);
20912091
TimeTzADT *tb = PG_GETARG_TIMETZADT_P(1);
20922092

2093-
delta = tb->time - ta->time;
2093+
delta = (tb->time - ta->time) + (tb->zone - ta->zone) * USECS_PER_SEC;
20942094

20952095
Assert(delta >= 0);
20962096

0 commit comments

Comments
 (0)