On Thu, 2004-12-02 at 10:45 -0500, Tom Lane wrote:
> (2) I think you lose much of the performance
> benefit as soon as you have to distinguish cases (b) and (c).  Ideally
> you would use MemoryContextContains for this, but that doesn't work
> reliably on pointers that point to fields of a tuple.

Why wouldn't a simple comparison work? We're passing two arguments into
the aggregate function: (a) corresponds to returning the first argument,
and (b) corresponds to returning the second argument. If the aggregate
wants to do something more than just return one of the arguments, they
can copy/alloc in the current context.

> I like the approach shown in my prototype patch better, because it
> doesn't create any backwards-compatibility issues for existing aggregate
> functions; instead individual aggregates may be rewritten to avoid
> palloc's.

Yeah, I like your approach as well (sorry, I had thought Simon's earlier
suggestion along these lines would have required adding knowledge about
builtin aggregates to advance_transition_function() itself; adding
knowledge to the aggregate implementation is a lot nicer).

-Neil



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to