postgres.git / summary / log / commit / refs

commit    f2d4f45c0ec7073dba75ffec8402b6d61de3bcfc
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Sat Aug 16 17:48:46 2014 +0000
First released in: 9.5.0, 9.2.10, 9.3.6, 9.4.0

    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.


src/backend/utils/adt/rangetypes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c index 3da08bb8370..96e686e6d69 100644 --- a/src/backend/utils/adt/rangetypes.c +++ b/src/backend/utils/adt/rangetypes.c @@ -917,12 +917,12 @@ range_overright_internal(TypeCacheEntry *typcache, RangeType *r1, RangeType *r2) /* An empty range is neither before nor after any other range */ if (empty1 || empty2) - PG_RETURN_BOOL(false); + return false; if (range_cmp_bounds(typcache, &lower1, &lower2) >= 0) - PG_RETURN_BOOL(true); + return true; - PG_RETURN_BOOL(false); + return false; } /* does not extend to left of? */ [parent: bdd62aabb4c3]