Re: Adding OLD/NEW support to RETURNING - Mailing list pgsql-hackers

From jian he
Subject Re: Adding OLD/NEW support to RETURNING
Date
Msg-id CACJufxGY+9n5ZEveF9iXnQRmTjSE-TRbEO9pAzdjOuWp_ue59w@mail.gmail.com
Whole thread Raw
In response to Re: Adding OLD/NEW support to RETURNING  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
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) *;



pgsql-hackers by date:

Previous
From: Xuneng Zhou
Date:
Subject: Re: Unsafe access BufferDescriptors array in BufferGetLSNAtomic()
Next
From: Bertrand Drouvot
Date:
Subject: Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)