Re: ffunc called multiple for same value
От | Ian Burrell |
---|---|
Тема | Re: ffunc called multiple for same value |
Дата | |
Msg-id | 410179A7.90102@rentrak.com обсуждение исходный текст |
Ответ на | Re: ffunc called multiple for same value (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: ffunc called multiple for same value
|
Список | 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.) > 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
В списке pgsql-hackers по дате отправления: