SQLSTATE 42704Severity lowLab verified

Incident brief

Undefined data type

Referencing a type that has not been created (or is misspelled or out of the search_path) raises this undefined-object error; 'currency' is not a built-in type.

What lands in your log

ERROR: type "currency" does not exist

Reproduced on PostgreSQL 18.4Verified 2026-07-24 (isolated lab, PostgreSQL 18.4)Verified against PostgreSQL 18.4 in an isolated lab environment

In 10 seconds

What triggers it
Create a table (or cast) that references a type name that does not exist.
Fix
Use an existing type (numeric, money, or a DOMAIN/type you have created).
Proof
Reproduced on PostgreSQL 18.4 → A single statement reproduces SQLSTATE 42704; the unknown type name is rejected and the LINE points at it.

Fix

What to do right now

Application-level steps for this error.

  • Use an existing type (numeric, money, or a DOMAIN/type you have created).
  • Create the missing type/domain first, or schema-qualify it if it lives elsewhere.
Fix SQL
CREATE DOMAIN currency AS numeric(12,2);
CREATE TABLE ledger (amount currency);
INSERT INTO ledger VALUES (10.00);

Verification

PG 18.4
Last verified
2026-07-24 (isolated lab, PostgreSQL 18.4)
Verification scope
Verified against PostgreSQL 18.4 in an isolated lab environment
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops