--
-- membership_rel__unapprove/1
--
create or replace function membership_rel__unapprove(
  integer
) returns int4 as $$

declare
  unapprove__rel_id             alias for $1;  
begin
    update membership_rels
    set member_state = 'needs approval'
    where rel_id = unapprove__rel_id;

    return 0; 
end;$$ language plpgsql;