... btw, there is another interesting definitional question here.
AFAICS, "ON EMPTY" effectively is an override for the aggregate's
final function. Does it actually make sense when there is a final
function? Specifically, if the final function were willing to
provide non-null output for zero rows in, should we still override
it? SUM and PRODUCT don't provide a lot of guidance here.
I'm also wondering idly how this interacts with "inverse transition
functions" for aggregates used as window functions.
regards, tom lane