PL/pgSQL question

From: Ycrux <ycrux(at)club-internet(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: PL/pgSQL question
Date: 2006-03-09 23:17:34
Message-ID: 4410B78E.2060903@club-internet.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All!
I'm trying to get working the below PL/pgSQL function without sucess.
The function is correctly created, but when I tested it i got:

# SELECT grantAccess('sara', 'sarapass');
ERROR: set-valued function called in context that cannot accept a set
CONTEXT: PL/pgSQL function "grantaccess" line 10 at return next
veillewm=#

What I'm missing?
Thank in advance
Younes

----------------- CODE BEGIN --------------------------
CREATE FUNCTION grantAccess(text,text) RETURNS SETOF users AS '
DECLARE
userlogin ALIAS FOR $1;
userpasswd ALIAS FOR $2;
row users%ROWTYPE;
BEGIN

FOR row IN SELECT user_id FROM users WHERE user_login = userlogin
AND user_passwd = userpasswd AND user_account = TRUE LOOP
RETURN NEXT row;
END LOOP;
RETURN;
END;
' LANGUAGE 'plpgsql';

----------------- CODE END --------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Ellis 2006-03-09 23:21:31 Re: majordomo unmaintained, postmaster emails ignored?
Previous Message Marc G. Fournier 2006-03-09 22:33:44 Re: majordomo unmaintained, postmaster emails ignored?