* Tom Lane ([EMAIL PROTECTED]) wrote: > That's not really the flavor of solution I'd like to have. Ideally, > it'd actually *work* to write > > my_ffunc(my_sfunc(my_sfunc(null, 1), 2)) > > and get the same result as aggregating over the values 1 and 2. The > trick is to make sure that my_sfunc and my_ffunc can only be used > together. Maybe we do need a type for each such aggregate ...
In general I like this idea but there are some complications, the main
one being where would the memory be allocated? I guess we could just
always use the QueryContext. The other issue is, in the above scenario
is it acceptable to modify the result of my_sfunc(null, 1) in the ,2
call? Normally it's unacceptable to modify your input, aggregates get a
special exception when called as an aggregate, but in this case you'd
have to copy the entire custom structure underneath, I'd think.
As for a type for each such aggregate, that seems reasonable to me,
honestly. I'd like for the type creation to be reasonably simple
though, if possible. ie: could we just provide NULLs for the
input/output functions instead of having to implement functions that
just return an error? Or perhaps have a polymorphic function which can
be reused that just returns an error. Additionally, we'd have to be
able to mark the types as being polymorhpic along the same lines as
anyelement/anyarray. Hopefully that's already easy, but if not it'd be
nice if it could be made easy...
Thanks,
Stephen
signature.asc
Description: Digital signature
