Re: Adding OLD/NEW support to RETURNING

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(at)vondra(dot)me>
Subject: Re: Adding OLD/NEW support to RETURNING
Date: 2024-10-14 15:34:21
Message-ID: CACJufxEAEGAWb09xT4kWtBXx=V-XBf72rJjvnMKL2cE6a-wBxw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 14, 2024 at 7:03 PM Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>
> > > typedef struct ReturningOption
> > > {
> > > NodeTag type;
> > > bool isNew;
> > > char *name;
> > > int location;
> > > } ReturningOption;
>
> Thinking about that struct some more, I think "isNew" is better done
> as an enum, since this is meant to be a generic option. So even though
> it might never have more than 2 possible values, I think it's neater
> done that way.
>

typedef struct ReturningOption
{
NodeTag type;
ReturningOptionKind option; /* specified option */
char *value; /* option's value */
ParseLoc location; /* token location, or -1 if unknown */
} ReturningOption;

@@ -4304,6 +4332,16 @@ raw_expression_tree_walker_impl(Node *no
return true;
}
break;
+ case T_ReturningClause:
+ {
+ ReturningClause *returning = (ReturningClause *) node;
+
+ if (WALK(returning->options))
+ return true;
+ if (WALK(returning->exprs))
+ return true;
+ }
+ break;

+ if (WALK(returning->options))
+ return true;
T_ReturningOption is primitive, so we only need to
"if (WALK(returning->exprs))"?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2024-10-14 16:05:58 Re: Adding OLD/NEW support to RETURNING
Previous Message Peter Eisentraut 2024-10-14 14:31:00 Re: Index AM API cleanup