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

Function plpgsql_param_eval_generic

src/pl/plpgsql/src/pl_exec.c:6586–6618  ·  view source on GitHub ↗

* plpgsql_param_eval_generic evaluation of EEOP_PARAM_CALLBACK step * * This handles all variable types, but assumes we do not need to invoke * MakeExpandedObjectReadOnly. */

Source from the content-addressed store, hash-verified

6584 * MakeExpandedObjectReadOnly.
6585 */
6586static void
6587plpgsql_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

Callers

nothing calls this directly

Calls 4

exec_eval_datumFunction · 0.85
format_type_beFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected