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

From: 高增琦 <pgf00a(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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-12 03:05:31
Message-ID: CAFmBtr31Tfz1EqkgiUUBtV416Ak+2gkjR6=ifJ0okFG_nxgCiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks a lot for reply.

2017-01-11 20:46 GMT+08:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> =?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.
>

At present, only transformSelectStmt and transformSetOperationStmt
has parseCheckAggregates. All other transformXXXStmt don't contain it.

This inconsistency makes me have the question at the first mail.
I think it maybe better to do something.

>
> 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
>

--
GaoZengqi
pgf00a(at)gmail(dot)com
zengqigao(at)gmail(dot)com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2017-01-12 03:19:01 Misplacement of function declaration in contrib/postgres_fdw/postgres_fdw.h
Previous Message Amit Kapila 2017-01-12 02:58:01 Re: parallelize queries containing subplans