I am new to postgres and getting an error message that I cannot find in Stackoverflow (?). I am trying to write a function that returns true when a person has the right to the task, and false - to the absence. This causes "ERROR: ROWS is not applicable when the function does not return a set." Found something in Spanish - but nothing in SO. Can someone explain this?
CREATE OR REPLACE FUNCTION "isPersonQualifiedForJob"(pid integer, jid integer) RETURNS bit AS ' IF (SELECT count(*) FROM "getSkillsForJob"("jid") "j" WHERE NOT EXISTS ( SELECT 1 FROM "getSkillsForPerson"("pid") "p" WHERE "j"."SkillID"="p"."SkillID" ) )> 0 THEN return 0; ELSE return 1; END IF; ' LANGUAGE sql VOLATILE COST 100 ROWS 1000; ALTER FUNCTION "isPersonQualifiedForJob"(integer) OWNER TO postgres;
source share