graphqlplpgsqlpostgraphile

graphile worker job causing issue to plpgsql function


we using postgraphile in our project,

create or replace function public.function()
returns public.xyz as $$
begin
if //condition// then
  if //condition// then
    //some logic
    return xyz
  else
    //logic
    select graphile_worker.add_job('email', json_build_object('subject', subject, 'email', email));
    return null
  end if;
   return null;
 end if;
end;
$$ language plpgsql strict security definer;

now when I hit the mutation, im getting - "message": "query has no destination for result data" error which I remove the graphile_worker.add_job, its doesn't thow any error


Solution

  • we need to change

    select graphile_worker.add_job
    

    to

    perform graphile_worker.add_job