Re: Do we support using agg or window functions in delete statement?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 高增琦 <pgf00a(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Do we support using agg or window functions in delete statement?
Date: 2017-01-11 12:46:20
Message-ID: 13380.1484138780@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?UTF-8?B?6auY5aKe55Cm?= <pgf00a(at)gmail(dot)com> writes:
> In transformDeleteStmt:

> qry->hasWindowFuncs = pstate->p_hasWindowFuncs;
> qry->hasAggs = pstate->p_hasAggs;
> if (pstate->p_hasAggs)
> parseCheckAggregates(pstate, qry);

> Do we support using agg or window function in delete statement?
> Or, this code should be removed?

I think it's dead code given the syntactic limitations on DELETE,
but I would not be in favor of removing it. Better to have it there to
keep transformDeleteStmt looking as much as possible like the other ones.
It's not like that's either expensive or a lot of code.

An example of why this would be penny-wise and pound-foolish is that
we might choose to apply the check that you can't write aggregates in
DELETE inside parseCheckAggregates. (We don't, but it's not an impossible
future restructuring.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-01-11 12:57:42 Re: WARM and indirect indexes
Previous Message Tom Lane 2017-01-11 12:37:40 Re: Passing query string to workers