Bruno Boettcher <[EMAIL PROTECTED]> 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