Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C1B26B5DC0C for ; Sat, 8 Oct 2011 13:32:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 30316-01 for ; Sat, 8 Oct 2011 16:32:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 662CFB5DBF2 for ; Sat, 8 Oct 2011 13:32:02 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p98GW1sP011373; Sat, 8 Oct 2011 12:32:01 -0400 (EDT) To: Steve Northamer cc: pgsql-sql@postgresql.org Subject: Re: plpgsql function executed multiple times for each return value In-reply-to: <4E8DEC80.3010706@gmail.com> References: <4E8DEC80.3010706@gmail.com> Comments: In-reply-to Steve Northamer message dated "Thu, 06 Oct 2011 13:59:28 -0400" Date: Sat, 08 Oct 2011 12:32:01 -0400 Message-ID: <11372.1318091521@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201110/6 X-Sequence-Number: 35890 Steve Northamer writes: > So my questions are: 1) How do we cause the paymentcalc function to be > executed only once? In recent versions, I think marking it volatile would be sufficient. regards, tom lane