* plpgsql_param_eval_generic evaluation of EEOP_PARAM_CALLBACK step * * This handles all variable types, but assumes we do not need to invoke * MakeExpandedObjectReadOnly. */
| 6584 | * MakeExpandedObjectReadOnly. |
| 6585 | */ |
| 6586 | static void |
| 6587 | plpgsql_param_eval_generic(ExprState *state, ExprEvalStep *op, |
| 6588 | ExprContext *econtext) |
| 6589 | { |
| 6590 | ParamListInfo params; |
| 6591 | PLpgSQL_execstate *estate; |
| 6592 | int dno = op->d.cparam.paramid - 1; |
| 6593 | PLpgSQL_datum *datum; |
| 6594 | Oid datumtype; |
| 6595 | int32 datumtypmod; |
| 6596 | |
| 6597 | /* fetch back the hook data */ |
| 6598 | params = econtext->ecxt_param_list_info; |
| 6599 | estate = (PLpgSQL_execstate *) params->paramFetchArg; |
| 6600 | Assert(dno >= 0 && dno < estate->ndatums); |
| 6601 | |
| 6602 | /* now we can access the target datum */ |
| 6603 | datum = estate->datums[dno]; |
| 6604 | |
| 6605 | /* fetch datum's value */ |
| 6606 | exec_eval_datum(estate, datum, |
| 6607 | &datumtype, &datumtypmod, |
| 6608 | op->resvalue, op->resnull); |
| 6609 | |
| 6610 | /* safety check -- needed for, eg, record fields */ |
| 6611 | if (unlikely(datumtype != op->d.cparam.paramtype)) |
| 6612 | ereport(ERROR, |
| 6613 | (errcode(ERRCODE_DATATYPE_MISMATCH), |
| 6614 | errmsg("type of parameter %d (%s) does not match that when preparing the plan (%s)", |
| 6615 | op->d.cparam.paramid, |
| 6616 | format_type_be(datumtype), |
| 6617 | format_type_be(op->d.cparam.paramtype)))); |
| 6618 | } |
| 6619 | |
| 6620 | /* |
| 6621 | * plpgsql_param_eval_generic_ro evaluation of EEOP_PARAM_CALLBACK step |
nothing calls this directly
no test coverage detected