Re: ffunc called multiple for same value

Mike Mascari <mascarm@mascari.com>

From: Mike Mascari <mascarm@mascari.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ian Burrell <imb@rentrak.com>, pgsql-hackers@postgresql.org
Date: 2004-07-23T20:39:05Z
Lists: pgsql-hackers
Tom Lane wrote:

> So I'm rather inclined to define this behavior as "not a bug".  The fact
> that you're complaining seems to indicate that your ffunc scribbles on
> its input, which is bad programming practice in any case.  Ordinarily
> I would not think that an ffunc should have any problem with being
> executed repeatedly on the same final transvalue.  (If you really want
> to do things that way, maybe your code should take responsibility for
> keeping a flag to execute just once, rather than pushing the cost onto
> everybody.)
> 
> Comments anyone?

As someone who makes use of C language aggregate functions, I agree 
with your analysis, so long as the fact that an ffunc may be invoked 
more than once is well documented, (i.e. an SGML <note> section 
might be nice.)

Mike Mascari