--
-- rel_segment__name/1
--
create or replace function rel_segment__name(
  integer
) returns varchar as $$

declare
  name__segment_id             alias for $1;  
  name__segment_name           varchar(200);  
begin
  return segment_name
  from rel_segments
  where segment_id = name__segment_id;

end;$$ language plpgsql;