Re: [GENERAL] plpgsql loop not returning value

2004-10-17 Thread Josh Close
On 17 Oct 2004 01:24:27 -0400, Greg Stark <[EMAIL PROTECTED]> wrote: > Uh, not in Postgres. Perhaps you're thinking of another database system? > In fact I suspect it's slowing down your system somewhat. > > -- > greg So, there is no locking taking place during inserts at all? Or updates? Also,

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Greg Stark
Josh Close <[EMAIL PROTECTED]> writes: > I didn't write it, but it's to avoid locking. Each table is for a > different server. They are all writing at the same time, and I guess > it speeds up the inserts to have them in different tables. Uh, not in Postgres. Perhaps you're thinking of another d

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Josh Close
On Sat, 16 Oct 2004 10:20:35 -0600, Michael Fuhr <[EMAIL PROTECTED]> wrote: > Glad you got it working. > > A question about your design: you appear to have a tblBatchHistory_X > table for each iId value in tblServers. Is there a reason for doing > that instead of having a single tblBatchHistory t

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Michael Fuhr
On Sat, Oct 16, 2004 at 09:30:32AM -0500, Josh Close wrote: > On Sat, 16 Oct 2004 00:59:34 -0600, Michael Fuhr <[EMAIL PROTECTED]> wrote: > > > > Add some RAISE INFO statements to print variables' values at key > > places. I wonder if one of your SUMs is returning NULL, causing > > your addition t

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Josh Close
On Sat, 16 Oct 2004 00:59:34 -0600, Michael Fuhr <[EMAIL PROTECTED]> wrote: > Add some RAISE INFO statements to print variables' values at key > places. I wonder if one of your SUMs is returning NULL, causing > your addition to evaluate to NULL. If so, then perhaps you should > use COALESCE to tu

Re: [GENERAL] plpgsql loop not returning value

2004-10-16 Thread Michael Fuhr
On Fri, Oct 15, 2004 at 10:56:06PM -0500, Josh Close wrote: > FOR this_rSum IN EXECUTE this_sQuery LOOP > this_iSum := this_rSum.isum; > END LOOP; > this_iTotal := this_iTotal + this_iSum; [snip] > If I return this_iSum or this_iTotal in the loop, I get a value. I

[GENERAL] plpgsql loop not returning value

2004-10-15 Thread Josh Close
I'm having a problem with a value coming out of a loop. CREATE OR REPLACE FUNCTION funmessagespermintotal() RETURNS int8 AS ' DECLARE this_rServer record; this_rSum record; this_iSum bigint; this_iTotal bigint; this_iMsgsPerMin bigint; this_sQuery varchar(500); BEGIN this_iTotal := 0; FOR th