David, if you can update your patch with some docs to explain the behaviour, it looks complete enough to think about committing it in early January, to allow other patches that depend upon it to stand a chance of getting into 9.5. (It is not yet ready, but I see it could be).
Sure, I've more or less added the docs from your patch. I still need to trawl through and see if there's anywhere else that needs some additions.
The above example is probably the best description of the need, since user defined aggregates must also understand this.
Could we please call these "combine functions" or other? MERGE is an SQL Standard statement type that we will add later, so it will be confusing if we use the "merge" word in this context.
Ok, changed.
David, your patch avoids creating any mergefuncs for existing aggregates. We would need to supply working examples for at least a few of the builtin aggregates, so we can test the infrastructure. We can add examples for all cases later.
In addition to MIN(), MAX(), BIT_AND(), BIT_OR, SUM() for floating point types, cash and interval. I've now added combine functions for count(*) and count(col). It seems that int8pl() is suitable for this.
Do you think it's worth adding any new functions at this stage, or is it best to wait until there's a patch which can use these?