Hi,
I have a postgres function returning a set of records (using RETURN
NEXT). While calling the function like this:
tasklist = func.get_tasklist(engine=engine).execute() # is this the
correct way?
I am getting this error:
SQLError: ('(ProgrammingError) set-valued function called in context
that cannot accept a set\nCONTEXT: PL/pgSQL function "get_tasklist"
line 6 at return next\n', <bound method TaskController.get_tasks of
<gcollab.controllers.task.TaskController object at 0xb742716c>>)
'SELECT get_tasklist()' {}
Am I calling the stored procedure correctly? Need help.
thanks
Sanjay
Here is code of the stored procedure:
CREATE OR REPLACE FUNCTION get_tasklist() RETURNS setof tasklist_t AS $
$
DECLARE
t tasklist_t%rowtype;
BEGIN
FOR t IN SELECT task_id, descr, 'Waiting', remind_at, 'Sanjay'
FROM task
LOOP
RETURN NEXT t;
END LOOP;
RETURN;
END;
$$ LANGUAGE PLPGSQL;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---