Skip to content

Commit 6ad2532

Browse files
committed
Fix bogus return macros in range_overright_internal().
PG_RETURN_BOOL() should only be used in functions following the V1 SQL function API. This coding accidentally fails to fail since letting the compiler coerce the Datum representation of bool back to plain bool does give the right answer; but that doesn't make it a good idea. Back-patch to older branches just to avoid unnecessary code divergence.
1 parent c5e2333 commit 6ad2532

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/utils/adt/rangetypes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,12 +912,12 @@ range_overright_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2)
912912

913913
/* An empty range is neither before nor after any other range */
914914
if (empty1 || empty2)
915-
PG_RETURN_BOOL(false);
915+
return false;
916916

917917
if (range_cmp_bounds(typcache, &lower1, &lower2) >= 0)
918-
PG_RETURN_BOOL(true);
918+
return true;
919919

920-
PG_RETURN_BOOL(false);
920+
return false;
921921
}
922922

923923
/* does not extend to left of? */

0 commit comments

Comments
 (0)