scribase
SQLSTATE 54000program_limit_exceededHTTP 500

Postgres error 54000: program limit exceeded

index row size exceeds btree version 4 maximum 2704 for index

A program limit was exceeded; most often a value too large for a B-tree index entry.

Common causes

  • Indexing long text or jsonb columns with a plain B-tree index.
  • Too many columns, arguments or nesting levels in one statement.

How to fix it

  • Index a hash of the value instead (create index on docs (md5(body))), or use a trigram or full-text GIN index for search.
  • Split very large statements into smaller ones.

Through a REST API

PostgREST, the REST layer behind supabase-js and Scribase, answers HTTP 500 for this error and returns the SQLSTATE in the code field of the JSON error body.

Questions

What does Postgres error 54000 mean?

54000 is program_limit_exceeded in class 54 (Program Limit Exceeded). A program limit was exceeded; most often a value too large for a B-tree index entry.

How do I fix 54000?

Index a hash of the value instead (create index on docs (md5(body))), or use a trigram or full-text GIN index for search. Split very large statements into smaller ones.

What HTTP status does a REST API return for 54000?

PostgREST, the REST layer behind supabase-js, answers 500.