| 2161 | } |
| 2162 | |
| 2163 | static Node * |
| 2164 | transformRowExpr(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 | |
| 2201 | static Node * |
| 2202 | transformTableValueExpr(ParseState *pstate, TableValueExpr *t) |
no test coverage detected