cross-database references are not implemented: “…”

SQLSTATE 0A000 condition feature_not_supported class 0A — Feature Not Supported severity ERROR
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 30 May 2025 · Reproduced live with the SQL on this page.

Symptoms

A query tried to reference an object in another database using a database-qualified name. PostgreSQL does not support cross-database queries and raises SQLSTATE 0A000 (feature_not_supported).

What the server log shows

ERROR:  cross-database references are not implemented: "otherdb.public.orders"

Why PostgreSQL raises this — what the manual says

As the postgres_fdw documentation explains:

PostgreSQL does not support directly referencing tables that live in another database from within a single query; to read data in a different database, map its tables into the current one with a foreign-data wrapper such as postgres_fdw (or use the dblink module).

Each connection is bound to one database; the planner cannot resolve names that reference a different database, so it rejects them with 0A000. Cross-database access requires an external mechanism.

Common causes

How to fix it

  1. Use the postgres_fdw extension to query foreign tables.
  2. Use the dblink extension for ad-hoc cross-database calls.
  3. Consolidate the objects into one database (use schemas to separate them).

Related & next steps

Reference: PostgreSQL 18 — postgres_fdw.