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

Function instantiate_empty_record_variable

src/pl/plpgsql/src/pl_exec.c:7583–7601  ·  view source on GitHub ↗

* If we have not created an expanded record to hold the record variable's * value, do so. The expanded record will be "empty", so this does not * change the logical state of the record variable: it's still NULL. * However, now we'll have a tupdesc with which we can e.g. look up fields. */

Source from the content-addressed store, hash-verified

7581 * However, now we'll have a tupdesc with which we can e.g. look up fields.
7582 */
7583static void
7584instantiate_empty_record_variable(PLpgSQL_execstate *estate, PLpgSQL_rec *rec)
7585{
7586 Assert(rec->erh == NULL); /* else caller error */
7587
7588 /* If declared type is RECORD, we can't instantiate */
7589 if (rec->rectypeid == RECORDOID)
7590 ereport(ERROR,
7591 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
7592 errmsg("record \"%s\" is not assigned yet", rec->refname),
7593 errdetail("The tuple structure of a not-yet-assigned record is indeterminate.")));
7594
7595 /* Make sure rec->rectypeid is up-to-date before using it */
7596 revalidate_rectypeid(rec);
7597
7598 /* OK, do it */
7599 rec->erh = make_expanded_record_from_typeid(rec->rectypeid, -1,
7600 estate->datum_context);
7601}
7602
7603/* ----------
7604 * convert_value_to_string Convert a non-null Datum to C string

Callers 6

exec_stmt_return_nextFunction · 0.85
exec_assign_valueFunction · 0.85
exec_eval_datumFunction · 0.85

Calls 5

revalidate_rectypeidFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
errdetailFunction · 0.50

Tested by

no test coverage detected