U121: Operator does not exist

Category: Application / User Errors
SQLSTATE: 42883 (Class 42 — Syntax Error or Access Rule Violation: undefined_function)
Urgency: low

Example Postgres Log Output:

ERROR: operator does not exist: boolean || boolean at character 13
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
STATEMENT: SELECT true || true


The operator used does not exist in the Postgres catalog. Note that operators are specific to the types of the values involved in the expression.

Possibly explanations are:

  1. You are using custom operators with Postgres, or operators from an extension (e.g. PostGIS), and forgot to set them up correctly

  2. You mistyped the operator (e.g. used the wrong symbol)

  3. There is no operator for one or multiple data types involved in the expression (and you meant to use a different data type / operator)

For example, with the above log output, the user likely meant to write:

SELECT true OR true

The || operator is commonly used to concatenate strings in PostgreSQL, not to do a boolean OR expression like it would in most programming languages.

Recommended Action:

Lookup the involved data types and the operator that was written, and adjust either the operator or data types.

You may also need to cast the involved values to the correct type, in order to use some type-specific operators.

This error would commonly occur during development, or in case you forgot to setup an extension/custom operators correctly on a staging/production system.

Learn More:

Download Free eBook: The Top 6 Postgres Log Events
Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →