Re: [SQL] Stored procedure returning row or resultset

2002-10-15 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > On Monday 14 Oct 2002 6:17 pm, Tom Lane wrote: >> Unfortunately that's not true at all, or at least not helpful for this >> problem. The cachable attribute was poorly named, because it leads >> people to think that PG *will* cache function results, as

Re: [SQL] Stored procedure returning row or resultset

2002-10-15 Thread Richard Huxton
On Monday 14 Oct 2002 6:17 pm, Tom Lane wrote: > Richard Huxton <[EMAIL PROTECTED]> writes: > > Have you looked at marking f1() etc cachable? This means Postgresql > > will only call the function once for each parameter-set. > > Unfortunately that's not true at all, or at least not helpful for thi

Re: [SQL] Stored procedure returning row or resultset

2002-10-14 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > Have you looked at marking f1() etc cachable? This means Postgresql > will only call the function once for each parameter-set. Unfortunately that's not true at all, or at least not helpful for this problem. The cachable attribute was poorly named, bec

Re: [SQL] Stored procedure returning row or resultset

2002-10-14 Thread Richard Huxton
On Monday 14 Oct 2002 3:22 pm, Heiko Stoermer wrote: > Hello, > > I'm trying to achieve the following with pl/pgsql in postgres 7.2: > > I need a stored procedure proc() that calculates values for some fields > a = f1() > b = a + f2() > c = b + f3() > and returns the tuple (a,b,c) as a rowtype, M

Re: [SQL] Stored procedure returning row or resultset

2002-10-14 Thread Brian Blaha
If your f1, f2, and f3 functions depend only on their arguments; that is, if you call one of those functions with the same set of arguments, it will return the same answer every time, you can define the functions as "iscachable" as follows: create function f1() ... language ... with (iscachable

[SQL] Stored procedure returning row or resultset

2002-10-14 Thread Heiko Stoermer
Hello, I'm trying to achieve the following with pl/pgsql in postgres 7.2: I need a stored procedure proc() that calculates values for some fields a = f1() b = a + f2() c = b + f3() and returns the tuple (a,b,c) as a rowtype, so that "select proc()" produces a "normal" resultset that can be used