Re: Adding OLD/NEW support to RETURNING

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Tomas Vondra <tomas@vondra.me>
Date: 2024-10-14T06:41:34Z
Lists: pgsql-hackers
typedef struct ReturningOption
{
    NodeTag        type;
    bool        isNew;
    char       *name;
    int            location;
} ReturningOption;
location should be type ParseLoc?


in process_sublinks_mutator

    else if (IsA(node, ReturningExpr))
    {
        if (((ReturningExpr *) node)->retlevelsup > 0)
            return node;
    }
this part doesn't have a coverage test?
the following is the minimum tests i come up with:

create table s (a int, b int);
create view sv as select * from s;
explain insert into sv values(1,2) returning (select new from
(values((select new))));


explain insert into sv values(1,2) returning (select new from (((select new))));
won't touch the changes we did.
but these two explain output plans are the same.



Commits

  1. doc: Updates for RETURNING OLD/NEW.

  2. Fix parsing of qualified relation names in RETURNING.

  3. Add OLD/NEW support to RETURNING in DML queries.

  4. Remove useless casts to (void *)

  5. Refactor/reword some error messages to avoid duplicates