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

Function transformRowExpr

src/backend/parser/parse_expr.c:2163–2199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2161}
2162
2163static Node *
2164transformRowExpr(ParseState *pstate, RowExpr *r, bool allowDefault)
2165{
2166 RowExpr *newr;
2167 char fname[16];
2168 int fnum;
2169
2170 newr = makeNode(RowExpr);
2171
2172 /* Transform the field expressions */
2173 newr->args = transformExpressionList(pstate, r->args,
2174 pstate->p_expr_kind, allowDefault);
2175
2176 /* Disallow more columns than will fit in a tuple */
2177 if (list_length(newr->args) > MaxTupleAttributeNumber)
2178 ereport(ERROR,
2179 (errcode(ERRCODE_TOO_MANY_COLUMNS),
2180 errmsg("ROW expressions can have at most %d entries",
2181 MaxTupleAttributeNumber),
2182 parser_errposition(pstate, r->location)));
2183
2184 /* Barring later casting, we consider the type RECORD */
2185 newr->row_typeid = RECORDOID;
2186 newr->row_format = COERCE_IMPLICIT_CAST;
2187
2188 /* ROW() has anonymous columns, so invent some field names */
2189 newr->colnames = NIL;
2190 for (fnum = 1; fnum <= list_length(newr->args); fnum++)
2191 {
2192 snprintf(fname, sizeof(fname), "f%d", fnum);
2193 newr->colnames = lappend(newr->colnames, makeString(pstrdup(fname)));
2194 }
2195
2196 newr->location = r->location;
2197
2198 return (Node *) newr;
2199}
2200
2201static Node *
2202transformTableValueExpr(ParseState *pstate, TableValueExpr *t)

Callers 2

transformExprRecurseFunction · 0.85
transformMultiAssignRefFunction · 0.85

Calls 8

transformExpressionListFunction · 0.85
list_lengthFunction · 0.85
parser_errpositionFunction · 0.85
lappendFunction · 0.85
makeStringFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
pstrdupFunction · 0.50

Tested by

no test coverage detected