postgresql - Postgres pg_trgm not working -


i'm new on postgres, i'm working project necessary check text similarity. found pg_trgm module have several functions work with.

i've installed postgres + contrib package on ubuntu, can't have similarity , other.

mydb=# create extension pg_trgm; error:  extension "pg_trgm" exists mydb=# \dx                                    list of installed extensions name   | version |   schema   |                                  description                             ---------+---------+------------+-------------------------------------------------------------------  pg_trgm | 1.0     | extensions | text similarity measurement , index searching based on trigrams  plpgsql | 1.0     | pg_catalog | pl/pgsql procedural language (2 rows)   mydb=# select similarity('hello','hell'); error:  function similarity(unknown, unknown) not exist line 1: select similarity('hello','hell');            ^ hint:  no function matches given name , argument types. might need add explicit type casts. 

is there other step use pg_trgm?

thanks.

emerson

the module installed schema extensions. guess that schema not in search path , therefor function not found. try

select extensions.similarity('hello','hell'); 

if don't want fully-qualify function names can add schema search_path:

alter user your_pg_user set search_path = public,extensions; 

if still gives error postgres user might not have necessary privileges call functions. in case log in superuser (typically postgres) , grant priviliges:

grant on schema extensions your_pg_user; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -