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

Function plpgsql_build_record

src/pl/plpgsql/src/pl_comp.c:1969–1990  ·  view source on GitHub ↗

* Build empty named record variable, and optionally add it to namespace */

Source from the content-addressed store, hash-verified

1967 * Build empty named record variable, and optionally add it to namespace
1968 */
1969PLpgSQL_rec *
1970plpgsql_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.

Callers 2

do_compileFunction · 0.85
plpgsql_build_variableFunction · 0.85

Calls 4

plpgsql_adddatumFunction · 0.85
plpgsql_ns_additemFunction · 0.85
palloc0Function · 0.50
pstrdupFunction · 0.50

Tested by

no test coverage detected