Lab-verifiedReproduced and fixed on PostgreSQL 17.12 · 2026-11-30 · container image postgres:17
PostgreSQL picks operators and functions by name and by argument types together. If a function exists only for other types, it reports that the function does not exist and shows the types it actually saw, for example round(double precision, integer). The HINT line suggests adding explicit type casts.
Read the types in the message first. They tell you which value has an unexpected type, or whether the function is missing completely (as with an extension that is not installed).
01Comparing a varchar column with a number
code is character varying, and WHERE code = 1001 compares it with an integer. PostgreSQL does not convert between text and numbers implicitly here, so it reports operator does not exist: character varying = integer.
Setup
CREATE TABLE products (code varchar(10) PRIMARY KEY, name text);
INSERT INTO products VALUES ('1001', 'pen'), ('1002', 'book');CREATE TABLE
INSERT 0 2SELECT * FROM products WHERE code = 1001;ERROR: 42883: operator does not exist: character varying = integer
LINE 1: SELECT * FROM products WHERE code = 1001;
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'products' AND column_name = 'code'; column_name | data_type
-------------+-------------------
code | character varying
(1 row)Compare with a string literal of the same type: code = '1001'. In application code, bind the parameter as a string.
SELECT * FROM products WHERE code = '1001'; code | name
------+------
1001 | pen
(1 row)02round(x, 2) on a double precision value
The two-argument round exists only for numeric. The catalog lists double precision, numeric and numeric, integer, so round(double precision, integer) has no match. This is one of the most searched forms of 42883.
Setup
CREATE TABLE measurements (id int PRIMARY KEY, val double precision);
INSERT INTO measurements VALUES (1, 3.14159), (2, 2.71828);CREATE TABLE
INSERT 0 2SELECT id, round(val, 2) FROM measurements;ERROR: 42883: function round(double precision, integer) does not exist
LINE 1: SELECT id, round(val, 2) FROM measurements;
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.SELECT pg_get_function_arguments(oid) FROM pg_proc WHERE proname = 'round' ORDER BY 1; pg_get_function_arguments
---------------------------
double precision
numeric
numeric, integer
(3 rows)Cast the value to numeric: round(val::numeric, 2). The result was 3.14 and 2.72.
SELECT id, round(val::numeric, 2) FROM measurements; id | round
----+-------
1 | 3.14
2 | 2.72
(2 rows)03An extension function such as uuid_generate_v4() is not installed
uuid_generate_v4() comes from the uuid-ossp extension. It is available on this server (pg_available_extensions shows it) but not installed in the database (installed_version is empty), so the function does not exist.
Setup
DROP EXTENSION IF EXISTS "uuid-ossp";NOTICE: 00000: extension "uuid-ossp" does not exist, skipping
DROP EXTENSIONCREATE TABLE api_keys (id uuid PRIMARY KEY, owner text);CREATE TABLEINSERT INTO api_keys VALUES (uuid_generate_v4(), 'kim');ERROR: 42883: function uuid_generate_v4() does not exist
LINE 1: INSERT INTO api_keys VALUES (uuid_generate_v4(), 'kim');
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.SELECT name, installed_version FROM pg_available_extensions WHERE name = 'uuid-ossp'; name | installed_version
-----------+-------------------
uuid-ossp |
(1 row)CREATE EXTENSION IF NOT EXISTS "uuid-ossp";CREATE EXTENSIONInstall it once per database with CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; (here it was run as postgres). After that the INSERT worked.
INSERT INTO api_keys VALUES (uuid_generate_v4(), 'kim');
SELECT count(*) FROM api_keys;INSERT 0 1
count
-------
1
(1 row)04Calling your own function with an argument of another type
get_discount takes integer, but grade is a text column, so PostgreSQL looks for get_discount(text) and does not find it. \df get_discount shows the argument types the function really has.
Setup
CREATE FUNCTION get_discount(p_grade integer) RETURNS numeric LANGUAGE sql AS $$ SELECT CASE WHEN p_grade >= 3 THEN 0.1 ELSE 0 END $$;
CREATE TABLE members (id int PRIMARY KEY, grade text);
INSERT INTO members VALUES (1, '3');CREATE FUNCTION
CREATE TABLE
INSERT 0 1SELECT id, get_discount(grade) FROM members;ERROR: 42883: function get_discount(text) does not exist
LINE 1: SELECT id, get_discount(grade) FROM members;
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.\df get_discount List of functions
Schema | Name | Result data type | Argument data types | Type
--------+--------------+------------------+---------------------+------
lab_a | get_discount | numeric | p_grade integer | func
(1 row)Cast the argument (grade::integer), or better, store the column with the type the function expects. The call returned 0.1.
SELECT id, get_discount(grade::integer) FROM members; id | get_discount
----+--------------
1 | 0.1
(1 row)FAQ
How do I fix operator does not exist: character varying = integer?
Compare values of the same type. Quote the number (code = '1001') or cast one side explicitly. Do not rely on implicit conversion between text and numbers.
Why does round(double precision, integer) not exist in PostgreSQL?
The two-argument round only accepts numeric. Use round(value::numeric, 2).
How do I fix function uuid_generate_v4() does not exist?
Install the extension in that database: CREATE EXTENSION IF NOT EXISTS "uuid-ossp";. Check pg_available_extensions first to see that it is available on the server.
What is SQLSTATE 42883?
42883 is undefined_function. It is used both for missing functions and for missing operators (such as = between two types).
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary roles created for the test, each owning a schema of the same name; postgres is the superuser. PostgreSQL 17.12