* Build empty named record variable, and optionally add it to namespace */
| 1967 | * Build empty named record variable, and optionally add it to namespace |
| 1968 | */ |
| 1969 | PLpgSQL_rec * |
| 1970 | plpgsql_build_record(const char *refname, int lineno, |
| 1971 | PLpgSQL_type *dtype, Oid rectypeid, |
| 1972 | bool add2namespace) |
| 1973 | { |
| 1974 | PLpgSQL_rec *rec; |
| 1975 | |
| 1976 | rec = palloc0(sizeof(PLpgSQL_rec)); |
| 1977 | rec->dtype = PLPGSQL_DTYPE_REC; |
| 1978 | rec->refname = pstrdup(refname); |
| 1979 | rec->lineno = lineno; |
| 1980 | /* other fields are left as 0, might be changed by caller */ |
| 1981 | rec->datatype = dtype; |
| 1982 | rec->rectypeid = rectypeid; |
| 1983 | rec->firstfield = -1; |
| 1984 | rec->erh = NULL; |
| 1985 | plpgsql_adddatum((PLpgSQL_datum *) rec); |
| 1986 | if (add2namespace) |
| 1987 | plpgsql_ns_additem(PLPGSQL_NSTYPE_REC, rec->dno, rec->refname); |
| 1988 | |
| 1989 | return rec; |
| 1990 | } |
| 1991 | |
| 1992 | /* |
| 1993 | * Build a row-variable data structure given the component variables. |
no test coverage detected