---------- * 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
| 7645 | * ---------- |
| 7646 | */ |
| 7647 | static inline Datum |
| 7648 | exec_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. |
no test coverage detected