---------- * do_cast_value Slow path for exec_cast_value. * ---------- */
| 7669 | * ---------- |
| 7670 | */ |
| 7671 | static Datum |
| 7672 | do_cast_value(PLpgSQL_execstate *estate, |
| 7673 | Datum value, bool *isnull, |
| 7674 | Oid valtype, int32 valtypmod, |
| 7675 | Oid reqtype, int32 reqtypmod) |
| 7676 | { |
| 7677 | plpgsql_CastHashEntry *cast_entry; |
| 7678 | |
| 7679 | cast_entry = get_cast_hashentry(estate, |
| 7680 | valtype, valtypmod, |
| 7681 | reqtype, reqtypmod); |
| 7682 | if (cast_entry) |
| 7683 | { |
| 7684 | ExprContext *econtext = estate->eval_econtext; |
| 7685 | MemoryContext oldcontext; |
| 7686 | |
| 7687 | oldcontext = MemoryContextSwitchTo(get_eval_mcontext(estate)); |
| 7688 | |
| 7689 | econtext->caseValue_datum = value; |
| 7690 | econtext->caseValue_isNull = *isnull; |
| 7691 | |
| 7692 | cast_entry->cast_in_use = true; |
| 7693 | |
| 7694 | value = ExecEvalExpr(cast_entry->cast_exprstate, econtext, |
| 7695 | isnull); |
| 7696 | |
| 7697 | cast_entry->cast_in_use = false; |
| 7698 | |
| 7699 | MemoryContextSwitchTo(oldcontext); |
| 7700 | } |
| 7701 | |
| 7702 | return value; |
| 7703 | } |
| 7704 | |
| 7705 | /* ---------- |
| 7706 | * get_cast_hashentry Look up how to perform a type cast |
no test coverage detected