git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b10e0e)
Fix BRIN minmax-multi distance for timetz type
Sun, 4 Apr 2021 17:21:41 +0000 (19:21 +0200)
Sun, 4 Apr 2021 17:22:23 +0000 (19:22 +0200)
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


diff --git a/src/backend/access/brin/brin_minmax_multi.c b/src/backend/access/brin/brin_minmax_multi.c
index 42bb177290e18ef6311f034a93df29819f5dc915..e182cd95ecd007457213613e827b51845ef30a02 100644 (file)
--- a/src/backend/access/brin/brin_minmax_multi.c
+++ b/src/backend/access/brin/brin_minmax_multi.c
@@ -2090,7 +2090,7 @@ brin_minmax_multi_distance_timetz(PG_FUNCTION_ARGS)
TimeTzADT *ta = PG_GETARG_TIMETZADT_P(0);
TimeTzADT *tb = PG_GETARG_TIMETZADT_P(1);
- delta = tb->time - ta->time;
+ delta = (tb->time - ta->time) + (tb->zone - ta->zone) * USECS_PER_SEC;
Assert(delta >= 0);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /