2

I have a postgres function called 'medrealize()' inside which i am creating temp table and creating index for temp tables using below lines

CREATE INDEX SQLOPS_RefICD_ICD10_idx ON  t$SQLOPS_RefICD_ICD10 USING gist (code gist_trgm_ops );
CREATE INDEX regexes_idx ON  t$regexes  USING gist (icdregex  gist_trgm_ops );

When calling the function from pgadmin, the function runs without any issues. But when calling the function from python using

cursor.execute("BEGIN")
cursor.execute("CALL medrealize();")
cursor.execute("COMMIT")

I am getting below error

operator class \"gist_trgm_ops\" does not exist for access method \"gist\"\

Any idea why its running fine when calling from PgAdmin and raising error when calling from Python?

1
  • You will need to show the actual procedure(it is not a function) medrealize. Also are you actually using $ in table names? Are you sure you are connecting to the same database in the Python and pgAdmin cases. gist_trgm_ops comes from the pg_trgm extension so that extension would need to be installed in the database. Commented Nov 25, 2021 at 16:05

1 Answer 1

5

Did you install the trigram index extension in your database ?

CREATE EXTENSION IF NOT EXISTS pg_trgm;  

If not, try to add it inside your function .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.