Max Ahston wrote:
create or replace function get_dns(varchar(40), varchar(40)) returns setof holder as '
declare
r holder%rowtype;
begin
IF ($2 == "tigris") then
for r in select Attribute, op, value FROM radreply WHERE username = $1 loop
return next r;
end loop;
return;
END IF;
end
' language 'plpgsql';


Returns the following:

ERROR:  column "tigris" does not exist
CONTEXT:  PL/pgSQL function "get_dns2" line 4 at if

Couple problems that I can see. First, that test should be:
IF $2 = ''tigris'' then
Second, you'll need to add a "return;" line after the "END IF" for the cases where there is no match. In fact, you can just move the one from within the IF...END IF to outside it.


HTH,

Joe

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to [EMAIL PROTECTED] so that your
     message can get through to the mailing list cleanly

Reply via email to