hi.
two minor issues.

    if (qry->returningList == NIL)
        ereport(ERROR,
                (errcode(ERRCODE_SYNTAX_ERROR),
                 errmsg("RETURNING must have at least one column"),
                 parser_errposition(pstate,

exprLocation(linitial(returningClause->exprs)))));

we can reduce one level parenthesis by:
    if (qry->returningList == NIL)
        ereport(ERROR,
                (errcode(ERRCODE_SYNTAX_ERROR),
                 errmsg("RETURNING must have at least one column"),
                 parser_errposition(pstate,

exprLocation(linitial(returningClause->exprs))));

seems no tests for this error case.
we can add one in case someone in future is wondering if this is ever reachable.
like:
create temp table s1();
insert into s1 default values returning new.*;
drop temp table s1;


transformReturningClause
case RETURNING_OPTION_NEW: not tested,
we can add one at src/test/regress/sql/returning.sql line 176:

INSERT INTO foo DEFAULT VALUES RETURNING WITH (new AS n, old AS o, new as n) *;


Reply via email to