---------- * 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
| 7616 | * ---------- |
| 7617 | */ |
| 7618 | static char * |
| 7619 | convert_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 |
no test coverage detected