Small cleanups in SQL/JSON code
authorAndrew Dunstan <[email protected]>
Fri, 15 Apr 2022 11:47:12 +0000 (07:47 -0400)
committerAndrew Dunstan <[email protected]>
Fri, 15 Apr 2022 11:49:20 +0000 (07:49 -0400)
These are to keep Coverity happy. In one case remove a redundant NULL
check, and in another explicitly ignore a function result that is already
known.

src/backend/parser/parse_expr.c
src/backend/utils/adt/jsonb.c

index 5fc0b1763c808d958d82cf15a275bd3551d5f3e3..33eb19a33fc689d9e50e2fe86a74dcc7d1785f0c 100644 (file)
@@ -3569,7 +3569,7 @@ coerceJsonFuncExpr(ParseState *pstate, Node *expr,
        location = exprLocation(expr);
 
        if (location < 0)
-               location = returning ? returning->format->location : -1;
+               location = returning->format->location;
 
        /* special case for RETURNING bytea FORMAT json */
        if (returning->format->format_type == JS_FORMAT_JSON &&
index 56c588bbabd3140505234713eba1d371d3f5f330..26d81366c9f8c3f00e58e2f149239d844d50e9e2 100644 (file)
@@ -2264,7 +2264,7 @@ JsonbUnquote(Jsonb *jb)
        {
                JsonbValue      v;
 
-               JsonbExtractScalar(&jb->root, &v);
+               (void) JsonbExtractScalar(&jb->root, &v);
 
                if (v.type == jbvString)
                        return pnstrdup(v.val.string.val, v.val.string.len);