Heikki Linnakangas <hlinn...@iki.fi> writes: > We've been doing that window agg thing for a long time, so I think > "works as window agg" should be the default for regular aggregates. For > ordered-set aggregates, "no merging, no more transfn() calls after > finalfn()" seems safest.
> It's a bit of a shame to have different defaults for regular and > ordered-set aggregates. But that is what we implicitly assume today, > anyway, and it's not too that hard to document. It's kind of a pain in the rear, really, especially for purposes like pg_dump, which will have to know the rule to decide whether it can omit an SMODIFY clause. (Which it should do if the value is default, so as not to make back-porting of dumps harder than necessary.) On reflection though I see little choice. Right now it's impossible to use an OSA as a window agg at all because the parser doesn't support that combination of options, and nodeWindowAgg is lacking necessary support too. If we ever get around to relaxing that, it would really be necessary that the default for user-created OSAs be "not safe as window agg", because almost certainly they wouldn't be. So I think there's no option but to have different default safety levels for OSA and normal aggs. As long as we're forced into that anyway, it does make sense to default to "not safe to merge" as well. We don't know for sure whether there are any user-created OSAs in the wild, but if there are, they likely borrowed code from orderedsetaggs.c. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers