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

Function exec_cast_value

src/pl/plpgsql/src/pl_exec.c:7647–7665  ·  view source on GitHub ↗

---------- * exec_cast_value Cast a value if required * * Note that *isnull is an input and also an output parameter. While it's * unlikely that a cast operation would produce null from non-null or vice * versa, that could happen in principle. * * Note: the estate's eval_mcontext is used for temporary storage, and may * also contain the result Datum if we have to do a conversion to a pa

Source from the content-addressed store, hash-verified

7645 * ----------
7646 */
7647static inline Datum
7648exec_cast_value(PLpgSQL_execstate *estate,
7649 Datum value, bool *isnull,
7650 Oid valtype, int32 valtypmod,
7651 Oid reqtype, int32 reqtypmod)
7652{
7653 /*
7654 * If the type of the given value isn't what's requested, convert it.
7655 */
7656 if (valtype != reqtype ||
7657 (valtypmod != reqtypmod && reqtypmod != -1))
7658 {
7659 /* We keep the slow path out-of-line. */
7660 value = do_cast_value(estate, value, isnull, valtype, valtypmod,
7661 reqtype, reqtypmod);
7662 }
7663
7664 return value;
7665}
7666
7667/* ----------
7668 * do_cast_value Slow path for exec_cast_value.

Callers 7

plpgsql_exec_functionFunction · 0.85
exec_stmt_foriFunction · 0.85
exec_stmt_return_nextFunction · 0.85
exec_assign_valueFunction · 0.85
exec_eval_integerFunction · 0.85
exec_eval_booleanFunction · 0.85

Calls 1

do_cast_valueFunction · 0.85

Tested by

no test coverage detected