Re: ffunc called multiple for same value

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ian Burrell <imb(at)rentrak(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ffunc called multiple for same value
Date: 2004-07-23 20:39:05
Message-ID: 41017769.3090204@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2004-07-23 20:40:36 Re: [HACKERS] Tutorial
Previous Message Tom Lane 2004-07-23 20:30:40 Re: [HACKERS] Tutorial