MCPcopy Create free account
hub / github.com/apache/cloudberry / convert_value_to_string

Function convert_value_to_string

src/pl/plpgsql/src/pl_exec.c:7618–7632  ·  view source on GitHub ↗

---------- * convert_value_to_string Convert a non-null Datum to C string * * Note: the result is in the estate's eval_mcontext, and will be cleared * by the next exec_eval_cleanup() call. The invoked output function might * leave additional cruft there as well, so just pfree'ing the result string * would not be enough to avoid memory leaks if we did not do it like this. * In most usages

Source from the content-addressed store, hash-verified

7616 * ----------
7617 */
7618static char *
7619convert_value_to_string(PLpgSQL_execstate *estate, Datum value, Oid valtype)
7620{
7621 char *result;
7622 MemoryContext oldcontext;
7623 Oid typoutput;
7624 bool typIsVarlena;
7625
7626 oldcontext = MemoryContextSwitchTo(get_eval_mcontext(estate));
7627 getTypeOutputInfo(valtype, &typoutput, &typIsVarlena);
7628 result = OidOutputFunctionCall(typoutput, value);
7629 MemoryContextSwitchTo(oldcontext);
7630
7631 return result;
7632}
7633
7634/* ----------
7635 * exec_cast_value Cast a value if required

Callers 7

exec_stmt_return_queryFunction · 0.85
exec_stmt_raiseFunction · 0.85
exec_stmt_assertFunction · 0.85
exec_stmt_dynexecuteFunction · 0.85
format_expr_paramsFunction · 0.85

Calls 3

MemoryContextSwitchToFunction · 0.85
getTypeOutputInfoFunction · 0.85
OidOutputFunctionCallFunction · 0.85

Tested by

no test coverage detected