Skip to content
PostgreSQL

PostgreSQL Error 42883

operator does not exist

Applies to: PostgreSQL 13 to 18 (examples run on PostgreSQL 18.6 in PGlite)
Last technically reviewed 24 October 2026 on PostgreSQL 18.6 (PGlite 0.5.11)
The full message
ERROR:  operator does not exist: integer = text
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
Other forms of this message
Function with argument types it has no version for
ERROR:  function round(double precision, integer) does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
LIKE on a number (LIKE is the ~~ operator; the pattern is still an untyped literal)
ERROR:  operator does not exist: integer ~~ unknown
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
A function from another database or an extension that is not installed
ERROR:  function isnull(integer, integer) does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
CALL of a procedure (same SQLSTATE)
ERROR:  procedure archive_orders(integer) does not exist
HINT:  No procedure matches the given name and argument types. You might need to add explicit type casts.
SQLSTATE
42883
Condition name
undefined_function
Product
PostgreSQL
Versions
PostgreSQL 13 to 18 (examples run on PostgreSQL 18.6 in PGlite)
Last reviewed
24 October 2026

What it means

SQLSTATE 42883 means PostgreSQL found no operator or function that accepts the exact argument types in your expression, either because the types do not match or because the function does not exist under that name.

PostgreSQL chooses an operator or function by its name and the data types of its arguments. = between two integers and = between two text values are different operators, and there is no = that takes an integer on one side and text on the other. PostgreSQL does not silently convert between numbers and text in comparisons, so when no candidate fits it raises 42883 (undefined_function). The message lists the types it saw, for example integer = text or round(double precision, integer), which tells you exactly where the mismatch is.

The word unknown in the message means a quoted literal with no type yet, such as '44%'. PostgreSQL normally resolves it from the other argument, but only when a matching operator exists: LIKE is defined for text, not for integer, so integer ~~ unknown fails. The same SQLSTATE covers a function name that does not exist at all, for example isnull() from SQL Server or ifnull() from MySQL, a function that lives in a schema outside the search_path, and a function provided by an extension that is not installed.

Common causes

  • Two columns of different types are compared or joined, for example an integer id against a text column that holds the same numbers.
  • A function is called with a type it has no version for, such as round(double precision, integer): the two-argument round accepts numeric only.
  • LIKE, ILIKE or a string function such as lpad or substring is used on a number or a date without casting it to text first.
  • The query uses a function from another database (isnull, ifnull, datediff, getdate) that PostgreSQL does not have under that name.
  • The function exists, but in a schema that is not on the search_path, or it belongs to an extension (such as uuid-ossp or unaccent) that is not installed in this database.

Diagnose it

Read-only These queries only read the system catalogs (pg_catalog, information_schema) and statistics views such as pg_stat_activity and pg_locks. They do not change data, roles or settings, so they are safe to run first.

What are the types on each side?

Use the column names from the failing expression.

SELECT table_name, column_name, data_type
FROM information_schema.columns
WHERE (table_name, column_name) IN (('customers', 'id'), ('orders', 'customer_ref'))
ORDER BY table_name;
What to look for

The declared type of each column, for example integer and text. They should match the types printed in the message; if one side is an expression, SELECT pg_typeof(expression) shows its type.

Which argument types does the function accept?

SELECT p.oid::regprocedure AS signature, n.nspname AS schema_name
FROM pg_proc AS p
JOIN pg_namespace AS n ON n.oid = p.pronamespace
WHERE p.proname = 'round'
ORDER BY 1;
What to look for

Every version of the function with its argument types and schema. For round you see round(numeric,integer) but no round(double precision,integer), so the first argument has to be numeric. No rows at all means the function does not exist under that name in this database.

Which operators exist for these types?

SELECT oprname, oprleft::regtype AS left_type, oprright::regtype AS right_type
FROM pg_operator
WHERE oprname = '~~'   -- LIKE; use '=' or another operator from the message
ORDER BY 2, 3;
What to look for

The type pairs the operator is defined for. LIKE (~~) is listed for text and character types but not for integer, so a number must be cast to text first.

Is the function in a schema on the search_path, or in an extension?

SELECT current_schemas(true) AS search_path_schemas;

SELECT extname, extversion
FROM pg_extension
ORDER BY extname;
What to look for

The schemas searched for unqualified names, and the extensions installed in this database. If the function is in another schema, qualify it (billing.add_tax(...)); if it comes from an extension that is not listed, it has to be installed first.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Cast one side so both types match

Read-only

Decide which type is correct and cast the other side to it. Casting the text column to integer keeps numeric comparison and lets an index on the integer column be used, but fails with 22P02 if any value is not a number; casting the integer to text always works but compares as strings.

SELECT c.name, o.total
FROM orders AS o
JOIN customers AS c ON c.id = o.customer_ref::integer;

Give the function the argument types it accepts

Read-only

Cast the argument to a type in the function's signature, and cast numbers to text before LIKE or string functions. See ROUND and CAST.

SELECT product_id, round(avg_rating::numeric, 1) AS rating
FROM ratings;

SELECT *
FROM contacts
WHERE phone_prefix::text LIKE '44%';

Use the PostgreSQL name for functions from other databases

Read-only

Replace isnull and ifnull with COALESCE, getdate() with now(), and datediff with date subtraction or age(). For a function in another schema, qualify it with the schema name.

SELECT id, coalesce(phone_prefix, 0) AS phone_prefix
FROM contacts;

Store the column with the right type

Changes schema

When a column holds numbers as text, the lasting fix is to change its type, so every join compares like with like. Check first that every value converts (see the 22P02 page for a read-only check).

Caution: Changing a column type rewrites the table and holds an ACCESS EXCLUSIVE lock for the whole rewrite, blocking reads and writes. Run it in a maintenance window on large tables, and update application code that sends the old type.

ALTER TABLE orders
    ALTER COLUMN customer_ref TYPE integer USING customer_ref::integer;

Examples

Joining an integer id to a text column

CREATE TABLE customers (id int PRIMARY KEY, name text);
CREATE TABLE orders (id int PRIMARY KEY, customer_ref text, total numeric(10,2));

SELECT c.name, o.total
FROM orders o
JOIN customers c ON c.id = o.customer_ref;
Result
ERROR:  operator does not exist: integer = text
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

Reproduced on PGlite 0.5.11 (PostgreSQL 18.6 compiled to WebAssembly), 24 October 2026.

round() with two arguments on a double precision column

round(x, n) is defined for numeric only, so cast the column: round(avg_rating::numeric, 1). The one-argument round(double precision) does exist.

CREATE TABLE ratings (product_id int, avg_rating double precision);

SELECT product_id, round(avg_rating, 1) FROM ratings;
Result
ERROR:  function round(double precision, integer) does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Reproduced on PGlite 0.5.11 (PostgreSQL 18.6 compiled to WebAssembly), 24 October 2026.

LIKE on an integer column

CREATE TABLE contacts (id int, phone_prefix int);

SELECT * FROM contacts WHERE phone_prefix LIKE '44%';
Result
ERROR:  operator does not exist: integer ~~ unknown
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

Reproduced on PGlite 0.5.11 (PostgreSQL 18.6 compiled to WebAssembly), 24 October 2026.

A SQL Server function name in PostgreSQL

CREATE TABLE contacts (id int, phone_prefix int);

SELECT id, isnull(phone_prefix, 0) FROM contacts;
Result
ERROR:  function isnull(integer, integer) does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Reproduced on PGlite 0.5.11 (PostgreSQL 18.6 compiled to WebAssembly), 24 October 2026.

How to prevent it

Give columns that hold the same thing the same type in every table, especially keys and the foreign keys that reference them; a foreign key between different types is rejected at creation time, which catches many of these mismatches early. Store numbers in numeric types, not text.

When porting SQL from SQL Server or MySQL, translate functions as you go (isnull and ifnull to coalesce, getdate to now, len to length) and test each query against PostgreSQL. In application code, bind parameters with their real types rather than sending every value as a string.

Common questions

How do I fix "operator does not exist: integer = text" in PostgreSQL?

Cast one side so both have the same type, for example c.id = o.customer_ref::integer, or c.id::text = o.customer_ref. If the text column always holds numbers, change its type to integer so the cast is no longer needed.

What does "unknown" mean in the error message?

It is a quoted literal that has not been given a type yet. PostgreSQL tries to resolve it from the other argument, but if no operator or function accepts the other argument's type, the literal stays unknown and the call fails. Casting the typed side (phone_prefix::text) usually solves it.

The function exists, so why does PostgreSQL say it does not?

PostgreSQL matches functions by name and argument types, so a version with different argument types counts as missing. It also looks only in the schemas on the search_path. List the function's signatures in pg_proc, then cast the arguments or qualify the name with its schema.

Why did this query work in MySQL or SQL Server?

Those databases convert between numbers and strings implicitly in many comparisons. PostgreSQL does not, which avoids silent conversions and wrong matches but means you have to cast explicitly when the types differ.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 24 October 2026; examples and diagnostics run on PostgreSQL 18.6 (PGlite 0.5.11). SQL-level examples were run in PGlite (PostgreSQL compiled to WebAssembly); examples that need a running server are shown as documented in the PostgreSQL documentation.

Still stuck on a PostgreSQL error?

Browse the full PostgreSQL error library, or get hands-on help from an experienced SQL professional.