Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9C679B5DBDB for ; Sat, 8 Oct 2011 12:50:26 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 26829-02 for ; Sat, 8 Oct 2011 15:50:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from nm35-vm3.bullet.mail.ne1.yahoo.com (nm35-vm3.bullet.mail.ne1.yahoo.com [98.138.229.99]) by mail.postgresql.org (Postfix) with SMTP id EFA11B5D803 for ; Sat, 8 Oct 2011 12:50:19 -0300 (ADT) Received: from [98.138.90.53] by nm35.bullet.mail.ne1.yahoo.com with NNFMP; 08 Oct 2011 15:50:19 -0000 Received: from [98.138.89.164] by tm6.bullet.mail.ne1.yahoo.com with NNFMP; 08 Oct 2011 15:50:19 -0000 Received: from [127.0.0.1] by omp1020.mail.ne1.yahoo.com with NNFMP; 08 Oct 2011 15:50:19 -0000 X-Yahoo-Newman-Id: 9715.8876.bm@omp1020.mail.ne1.yahoo.com Received: (qmail 13925 invoked from network); 8 Oct 2011 15:50:18 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:References:Mime-Version:In-Reply-To:X-Apple-Yahoo-Original-Message-Folder:Content-Type:Content-Transfer-Encoding:Message-Id:Cc:X-Mailer:From:X-Apple-Yahoo-Replied-Msgid:Subject:Date:To; b=AYgvqUS2cRpK56bgvgoXkjgJ35hCHLImXfI6A91AOkULsqCPUlh1ghoKpW8xuB2iBo8C9mzrk/pp+8cvFkgEGzlGdbubL3IbOtvu4MEetHyYHd8Nw1oar/reFhvSx1t95Z6XUOK7V7av+Y/Edmvjg9LV5fRirYco9/3vh5eHoc4= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1318089018; bh=R8YVZsituqSd44MNn9J3mUso8FggdyrgTe15Jj6hpQk=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:References:Mime-Version:In-Reply-To:X-Apple-Yahoo-Original-Message-Folder:Content-Type:Content-Transfer-Encoding:Message-Id:Cc:X-Mailer:From:X-Apple-Yahoo-Replied-Msgid:Subject:Date:To; b=C3ygVL65hYMNN57/zACSdq9P+smbnrkpqQ9005DNnAAaZdBlO83hnA3sGEDeS7b9EQcgNzMvBJixEO+AnlnTRc1sktszCQ0cMDplCCtsJBAmWhjc85RcdV3EsQFVvCxr091wMLlqFeA0ktusbpUUL7rYIFXzjH9TljZgsDdDg5c= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: dNU8OCcVM1kIZjFHEvpwtCkTuKSrxTDGAHwXRtBVrg1ragL tsHm4gzx2EBsm6EhE.o5fQwqOe4WjeoxrvN_B.kC8gw8Vh2VWCOzPfhZqgle qYFlnv1z_vqYSxe2tisANAk_4Z8X36zSERVOFGtIQmQPCzmJyT8ZOwnx0b5m 1Unlnh8dqduhseDYb6iDjLZYnixXF7k2TmXKsdzYK7Luhlrc_xmGQoxd9HUq .vsnr0VYws5uMRxqm_m0dh9Prb3mr3eP33nLw8icxMTuXHtuPHkf_zVq08Nu oRgVQTyvM06uatqaSORRJrT6K5cuOsyWA7M6KNzfagcOStijBzbmgZtJN2h9 gOKwu.cVKToSfg1dVru7HqKqRAtbk6esIKQZB5QQMZZWEGhLxzIsvGsv49A6 6wxH.ng-- X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from [192.12.17.102] (polobo@24.93.23.188 with xymcookie) by smtp101-mob.biz.mail.ne1.yahoo.com with SMTP; 08 Oct 2011 08:50:18 -0700 PDT References: <4E8DEC80.3010706@gmail.com> Mime-Version: 1.0 (iPad Mail 8J2) In-Reply-To: <4E8DEC80.3010706@gmail.com> X-Apple-Yahoo-Original-Message-Folder: Inbox Content-Type: multipart/alternative; boundary=Apple-Mail-1-479406219 Content-Transfer-Encoding: 7bit Message-Id: <4852CB86-2376-4A88-9B60-255FD9CFCDC3@yahoo.com> Cc: "pgsql-sql@postgresql.org" X-Mailer: iPad Mail (8J2) From: David Johnston X-Apple-Yahoo-Replied-Msgid: 1_634725_AOikiGIAAKtdTpBqNAX8WRmATx0 Subject: Re: plpgsql function executed multiple times for each return value Date: Sat, 8 Oct 2011 11:50:21 -0400 To: Steve Northamer X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.002 tagged_above=-5 required=5 tests=BAYES_05=-0.5, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201110/5 X-Sequence-Number: 35889 --Apple-Mail-1-479406219 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > So my questions are: 1) How do we cause the paymentcalc function to be ex= ecuted only once? and 2) How do we call a table returning function with inp= uts from a table? >=20 > Thank you very much! >=20 > Steve >=20 WITH func AS ( SELECT FUNC(...) AS func_result FROM ... ) SELECT (func.func_result).* FROM func David J. --Apple-Mail-1-479406219 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=utf-8
So my questions are:  1) How do we cause the paymentcalc function to be executed only once?  and 2) How do we call a table returning function with inputs from a table?

Thank you very much!

Steve


WITH func AS (
   SELECT FUNC(...) AS func_result FROM ...
)
SELECT (func.func_result).* FROM func

David J.


--Apple-Mail-1-479406219--