I am using levenshtein() function in my SQL script. I am using Postgresql database and client to execute the script. It's throwing an error:
function levenshtein(character varying, character varying) does not exist. HINT : No function matches the given name and argument types. You might need to add explicit type casts.
I know the common solution to it i.e creating extensions like 'fuzzystrmatch' which I already did and strange thing is that the same script ran smoothly 4 days ago when I created fuzzystrmatch extension in the first place!
Below is my line of code where levenshtein() is used.
as $$select (1.0 - levenshtein($1, $2)::real/greatest(length($1), length($2)))::real;$$;
This SQL command tells you where the extension is currently installed:
SELECT n.nspname
FROM pg_extension e
JOIN pg_namespace n
ON e.extnamespace = n.oid
WHERE e.extname = 'fuzzystrmatch';
If that not on your search_path
, your query will not find the function.
To have the extension in a different schema, in the following example public
, drop and recreate it:
DROP EXTENSION fuzzystrmatch;
CREATE EXTENSION fuzzystrmatch SCHEMA public;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With