diff options
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r-- | src/backend/parser/parse_expr.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 698f206f169..d22d8a12bac 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -1692,6 +1692,9 @@ static Node * transformRowExpr(ParseState *pstate, RowExpr *r) { RowExpr *newr = makeNode(RowExpr); + char fname[16]; + int fnum; + ListCell *lc; /* Transform the field expressions */ newr->args = transformExpressionList(pstate, r->args); @@ -1699,7 +1702,16 @@ transformRowExpr(ParseState *pstate, RowExpr *r) /* Barring later casting, we consider the type RECORD */ newr->row_typeid = RECORDOID; newr->row_format = COERCE_IMPLICIT_CAST; - newr->colnames = NIL; /* ROW() has anonymous columns */ + + /* ROW() has anonymous columns, so invent some field names */ + newr->colnames = NIL; + fnum = 1; + foreach(lc, newr->args) + { + snprintf(fname, sizeof(fname), "f%d", fnum++); + newr->colnames = lappend(newr->colnames, makeString(pstrdup(fname))); + } + newr->location = r->location; return (Node *) newr; |