Find and fix slow Postgres queries on Supabase & Neon: pganalyze now supports both platforms

U142: Object does not exist

Category: Application Errors
SQLSTATE: 42704 (Class 42 - Syntax Error or Access Rule Violation: undefined_object), and the related undefined_* codes
Urgency: low

Example Postgres Log Output:

ERROR:  role "app_readonly" does not exist
STATEMENT:  GRANT SELECT ON mytable TO app_readonly;
ERROR:  type "myenum" does not exist at character 32
STATEMENT:  ALTER TABLE mytable ADD COLUMN status myenum;
ERROR:  extension "pg_stat_statements" does not exist
STATEMENT:  ALTER EXTENSION pg_stat_statements UPDATE;

Explanation:

A statement referenced a database object that Postgres could not find. This is the catch-all classification for object kinds that do not have a classification of their own.

The most frequently seen object kinds have their own event types, and are not reported here:

Recommended Action:

Investigate the application code to determine why it’s attempting to access these missing objects.

Some common causes:

  • For a missing type, extension or similar, the object may exist in a schema that is not on the connection’s search_path
  • A migration that has not been applied on this database
  • Case sensitivity: unquoted identifiers are folded to lower case, so CREATE ROLE "AppUser" must be referenced as "AppUser", not as AppUser.

If the reference is intentionally optional, many DROP commands accept IF EXISTS to avoid the error entirely.

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 →