Small code simplifications
authorPeter Eisentraut <[email protected]>
Thu, 3 Dec 2020 10:35:20 +0000 (11:35 +0100)
committerPeter Eisentraut <[email protected]>
Thu, 3 Dec 2020 10:44:13 +0000 (11:44 +0100)
strVal() can be used in a couple of places instead of coding the same
thing by hand.

src/backend/foreign/foreign.c
src/backend/parser/gram.y

index 61e48ca3f87d79b3f9ae8b26e88622f1a91b2202..3e79c852c1715be5a19a7a5440313f33321308fd 100644 (file)
@@ -544,7 +544,7 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options)
        nulls[0] = false;
        if (def->arg)
        {
-           values[1] = CStringGetTextDatum(((Value *) (def->arg))->val.str);
+           values[1] = CStringGetTextDatum(strVal(def->arg));
            nulls[1] = false;
        }
        else
index 61f023604153d4224578bb034cee567bd253d49e..469de52bc29b671ac7f2d103a47f64fb5648b36b 100644 (file)
@@ -13890,7 +13890,7 @@ func_expr_common_subexpr:
                     * Convert SystemTypeName() to SystemFuncName() even though
                     * at the moment they result in the same thing.
                     */
-                   $$ = (Node *) makeFuncCall(SystemFuncName(((Value *) llast($5->names))->val.str),
+                   $$ = (Node *) makeFuncCall(SystemFuncName(strVal(llast($5->names))),
                                               list_make1($3),
                                               COERCE_EXPLICIT_CALL,
                                               @1);