Steve Randall <srandall(at)s3(dot)com> writes:
> I have been able to reproduce the error in my development environment.
> EXPLAIN output is attached. EXPLAIN ANALYZE fails with the error
> mentioned.
Ah, I've duplicated it. My previous attempt to reverse-engineer your
test case was not selecting a partial-aggregation plan.
Immediate impression is that the logic for planning partial grouped
aggregation did not get the zero-sort-keys case right. In my hands
it produces
TRAP: BadArgument("!(nkeys > 0)", File: "tuplesort.c", Line: 763)
2016-11-10 10:44:26.955 EST [14415] LOG: server process (PID 15726) was terminated by signal 6: Aborted
but in a non-assert build of course you'd get some other misbehavior.
regards, tom lane