Returning -1 from a function with bool as return value is the same as returning true. Now, the code is dead (since elog(ERROR, ...) does not return) so it doesn't matter to the compiler, but changing to false is less confusing for the programmer. Appologies if this is seen as unnecessary churn.
The same code is present since 9.4, but perhaps it's not really worth backporting since it is more of an aesthetic change?
From 11611a4c0268379b45e11faf50c927c5997d70ee Mon Sep 17 00:00:00 2001 From: Rikard Falkeborn <rikard.falkeb...@gmail.com> Date: Sun, 12 May 2019 00:08:30 +0200 Subject: [PATCH] Fix dead code return value in jsonb_util Returning -1 in a function with bool as return value is the same as returning true. The change is in dead code since elog(ERROR, ...) never returns, but changing to false remove some potential confusion. --- src/backend/utils/adt/jsonb_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c index 3b249fe8cb..1a28d75c59 100644 --- a/src/backend/utils/adt/jsonb_util.c +++ b/src/backend/utils/adt/jsonb_util.c @@ -1318,7 +1318,7 @@ equalsJsonbScalarValue(JsonbValue *aScalar, JsonbValue *bScalar) } } elog(ERROR, "jsonb scalar type mismatch"); - return -1; + return false; } /* -- 2.21.0