* 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. */
| 7581 | * However, now we'll have a tupdesc with which we can e.g. look up fields. |
| 7582 | */ |
| 7583 | static void |
| 7584 | instantiate_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 |
no test coverage detected