Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eAKGdds26677 for ; Mon, 20 Nov 2000 11:39:39 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id eAKGbew28079; Mon, 20 Nov 2000 11:37:40 -0500 (EST) To: Bruno Boettcher cc: pgsql-sql@postgresql.org Subject: Re: pgpl-problem, what's wrong with my loop? In-reply-to: <20001120172105.E25191@erm1.u-strasbg.fr> References: <20001120165133.D25191@erm1.u-strasbg.fr> <20001120172105.E25191@erm1.u-strasbg.fr> Comments: In-reply-to Bruno Boettcher message dated "Mon, 20 Nov 2000 17:21:05 +0100" Date: Mon, 20 Nov 2000 11:37:40 -0500 Message-ID: <28076.974738260@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200011/158 X-Sequence-Number: 189 Bruno Boettcher writes: > CREATE FUNCTION accSum(text,text) RETURNS int4 AS ' > DECLARE > col ALIAS FOR $1; > sumup ALIAS FOR $2; > ... > FOR arow IN SELECT currency,amount FROM journal WHERE col=sumup LOOP Looks like the WHERE condition is testing for equality between the two parameters of the function. Since evidently that wasn't what you meant to do, perhaps you'd be well advised to choose local-variable names that don't conflict with column names of your tables... regards, tom lane