--
-- content_keyword__is_leaf/1
--
create or replace function content_keyword__is_leaf(
  integer
) returns bool as $$

declare
  is_leaf__keyword_id             alias for $1;  
begin

  return 
      count(*) = 0
  from 
    cr_keywords k
  where
    k.parent_id = is_leaf__keyword_id;
 
end;$$ language plpgsql;