PostgreSQL: operator does not exist
ERROR: operator does not exist: <ltype> <op> <rtype>Postgres could not find an operator for the types on each side. It almost always means a type mismatch, such as comparing an integer to text with no implicit cast between them. Cast one side explicitly.
What this error means
Operators in Postgres are defined for specific type pairs. When you use one with types that have no matching operator, and no implicit cast bridges them, you get this error along with a HINT to add explicit type casts.
The usual cause is a value bound as text being compared to a typed column, or a missing extension that would provide the operator.
How to fix it
The two sides are different types
Cast one side so an operator matches.
SELECT * FROM t WHERE id = '42'::int;A parameter is bound as text
Fix the parameter type in your client, or cast it in the query.
The operator comes from an extension
Install the extension that defines it, for example pg_trgm for similarity operators.
CREATE EXTENSION IF NOT EXISTS pg_trgm;How to avoid it next time
- Keep column and parameter types aligned so comparisons resolve without casts.
- Install operator-providing extensions in your migrations.
Frequently asked questions
What does the HINT about explicit type casts mean?
Postgres is telling you the fix: add a cast such as ::int or ::uuid to one side so the types match.
Why does integer = text fail?
There is no built-in operator for integer against text and no implicit cast, so you must cast one side.
Stop struggling with SQL
Use FluentDB, the AI database client for macOS.
Related errors
Part of the PostgreSQL error reference. Last reviewed 2026-07-31.