Re: Wrong aggregate result when sorting by a NULL value

Jeff Janes <jeff.janes@gmail.com>

From: Jeff Janes <jeff.janes@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Andrew Gierth <andrew@tao11.riddles.org.uk>, obouda@email.cz, Pg Bugs <pgsql-bugs@postgresql.org>
Date: 2018-11-04T14:11:36Z
Lists: pgsql-bugs
On Sat, Nov 3, 2018 at 7:08 PM Andres Freund <andres@anarazel.de> wrote:

> >
> > Hm, I'm somewhat confused, let me look into that. The JIT code shouldn't
> > really need to be changed here - it's the *generation* of expression
> > steps that's going wrong - which then later get turned into JITed code,
> > but that part worked previously for other expressions.
>
> Turns out it's not a great idea to generate EEOP_AGG_STRICT_INPUT_CHECK
> expressions with nargs = 0. Head -> Desk.  Pushed a fix (+ new
> assertion).
>
>
I'm now getting a compiler warning:

execExpr.c: In function 'ExecBuildAggTrans':
execExpr.c:2864:7: warning: unused variable 'numInputs' [-Wunused-variable]
   int   numInputs = pertrans->numInputs;

Cheers,

Jeff

Commits

  1. Fix unused-variable warning.

  2. Prevent generating EEOP_AGG_STRICT_INPUT_CHECK operations when nargs == 0.

  3. Fix STRICT check for strict aggregates with NULL ORDER BY columns.

  4. Expression evaluation based aggregate transition invocation.