Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using pg_trgm extension #1248

Closed
pedrorjbr opened this issue Mar 19, 2025 · 0 comments
Closed

Using pg_trgm extension #1248

pedrorjbr opened this issue Mar 19, 2025 · 0 comments

Comments

@pedrorjbr
Copy link

I am using sql alchemy with pg_trgm ( similarity function) extension.
I have alredy installed the pg_trgm extension. Executing the query directly from SQL UI, like dbeaver, it works. But on production, throgh sql alchemy and asyncpg....

I am getting:
File "asyncpg/protocol/protocol.pyx", line 165, in prepare
asyncpg.exceptions.UndefinedFunctionError: function similarity(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.

The query seems to be right:

SELECT dr_consulta.practitioners.name, dr_consulta.practitioners.gender, dr_consulta.practitioners.nrp, dr_consulta.practitioners.nrp_type, dr_consulta.practitioners.nrp_uf, dr_consulta.practitioners.external_id, dr_consulta.practitioners.id, dr_consulta.practitioners.created_at, dr_consulta.practitioners.updated_at, similarity(dr_consulta.practitioners.name, $1::VARCHAR) AS sim \nFROM dr_consulta.practitioners ORDER BY sim DESC \n LIMIT $2::INTEGER]\n[parameters: ('Renata Fortes Itagyba', 5)

Image

asyncpg==0.30.0
PostgreSQL 15.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant