-- -- category_synonym__get_similarity/3 -- create or replace function category_synonym__get_similarity( integer, integer, bigint ) returns int4 as $$ -- calculates similarity of two strings declare p_len1 alias for $1; p_len2 alias for $2; p_matches alias for $3; begin return (p_matches * 200 / (p_len1 + p_len2)); end;$$ language plpgsql;