how do you handle result sets in libpq (pypgsql)

rrk <rrk-2MFtr6hmVTfNrH2dXS7IVwC/[email protected]> Tue, 15 Jun 2004 07:33:06 -0500
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
is it possible to use a result set(record) returned by a function  if so 
what is the syntax
i get the following error

''' libpq.OperationalError : ERROR:  set-valued function called in 
context that cannot accept a set
CONTEXT:  PL/pgSQL function "dialup_checkjobtask" line 15 at return next

from this function

CREATE OR REPLACE FUNCTION public.dialup_checkjobtask(varchar, int4)
  RETURNS SETOF tmpdialuptj AS
'
declare answer integer;
             res record;          
          
BEGIN
  select * from tmpDIALUPTJ  into res;
  res.job_id = 0; 
  res.task_id = 0; 
 
  select count(*) from jobs where jobnumber =  $1 and isdeleted = 0 into 
answer;
  if (answer > 0) then select job_id  from jobs  where jobnumber =  $1 
and isdeleted = 0 into res.job_id;  else res.job_id = 0; end if;
 
  select count(*) from tasks where number =  $2 and isdeleted = 0 into 
answer;
  if (answer > 0) then  select task_id  from tasks  where number =  $2  
and isdeleted = 0 into res.task_id; else res.task_id =0; end if;
 
  RETURN NEXT res;
  RETURN;
END;
'
  LANGUAGE 'plpgsql' VOLATILE;


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND