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.)


We are doing things in the aggregates that make them troublesome when called the ffunc is called multiple times. The state structure uses a lot of memory for intermediate work. The memory needs to be freed as soon as possible otherwise there is a danger of running of out memory. It is possible to store the resuts on the first ffunc call, free the intermediate state, return the results on later calls, and make sure the free only happens once.


The docs didn't make clear that calling ffunc multiple times could happens so we did not code to allow it.

 - Ian



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to [EMAIL PROTECTED] so that your
     message can get through to the mailing list cleanly

Reply via email to