Re: [SQL] plpgsql function executed multiple times for each return value

2011-10-08 Thread Tom Lane
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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)

Re: [SQL] plpgsql function executed multiple times for each return value

2011-10-08 Thread David Johnston
> 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_re

[SQL] plpgsql function executed multiple times for each return value

2011-10-08 Thread Steve Northamer
We have a plpgsql function called paymentcalc, which calculates the payment necessary to pay off a loan. It's defined like this: CREATE OR REPLACE FUNCTION paymentcalc(IN amount numeric, IN interestrate numeric, IN termmonths integer, IN paymentfreq integer, IN dueday1 integer, IN dueday2 i

Re: [SQL] Edit multiple rows concurrent save

2011-10-08 Thread Jasen Betts
On 2011-09-29, Péter Szabó wrote: > users_has_cards.auctions + users_has_cards.decks never can be higher > then users_has_cards.total. It should be also granted that > users_has_cards.total - users_has_cards.auctions number of cards from > a specific type can be in any decks. > > The deck assembl