Lab-verifiedReproduced and fixed on PostgreSQL 17.12 · 2026-11-29 · container image postgres:17
3F000 is raised when a statement explicitly needs a schema, for example CREATE TABLE schema.table or GRANT … ON SCHEMA, and PostgreSQL cannot find it. Unquoted names are folded to lowercase, so the schema in the message is always the lowercase form unless you quoted it.
The three causes below come up in migrations and setup scripts. In each test the fix was either creating, renaming, or spelling the schema correctly.
01CREATE TABLE in a schema that was not created yet
CREATE TABLE sales.orders (...) failed with 3F000: schema "sales" does not exist, and psql pointed at sales.orders.
After CREATE SCHEMA sales AUTHORIZATION lab_a (run as postgres), the same CREATE TABLE succeeded.
CREATE TABLE sales.orders (id int PRIMARY KEY, amount numeric);ERROR: 3F000: schema "sales" does not exist
LINE 1: CREATE TABLE sales.orders (id int PRIMARY KEY, amount numeri...
^CREATE SCHEMA sales AUTHORIZATION lab_a;CREATE SCHEMACreate the schema first in the migration. AUTHORIZATION makes the app role the owner, so it can create tables there.
CREATE TABLE sales.orders (id int PRIMARY KEY, amount numeric);CREATE TABLE02The schema was created with quotes as "Sales"
The schema was created as "Sales" (with quotes, as GUI tools often do). CREATE TABLE Sales.orders without quotes is read as sales, so it failed with schema "sales" does not exist.
pg_namespace showed the real name was Sales. After ALTER SCHEMA "Sales" RENAME TO sales, the same statement without quotes succeeded.
Setup
CREATE SCHEMA "Sales" AUTHORIZATION lab_a;CREATE SCHEMACREATE TABLE Sales.orders (id int PRIMARY KEY);ERROR: 3F000: schema "sales" does not exist
LINE 1: CREATE TABLE Sales.orders (id int PRIMARY KEY);
^SELECT nspname FROM pg_namespace WHERE lower(nspname) = 'sales'; nspname
---------
Sales
(1 row)ALTER SCHEMA "Sales" RENAME TO sales;ALTER SCHEMAAlternatively keep the name and always write "Sales" in quotes. Renaming to lowercase means you never need quotes.
CREATE TABLE Sales.orders (id int PRIMARY KEY);CREATE TABLE03A typo in the schema name in GRANT
GRANT USAGE ON SCHEMA report TO lab_b failed with schema "report" does not exist. psql's \dn listed the actual schema as reports.
With the correct name, both GRANT USAGE ON SCHEMA reports and GRANT SELECT ON reports.daily succeeded.
Setup
CREATE SCHEMA reports AUTHORIZATION lab_a;
CREATE TABLE reports.daily (d date, total numeric);
ALTER TABLE reports.daily OWNER TO lab_a;CREATE SCHEMA
CREATE TABLE
ALTER TABLEGRANT USAGE ON SCHEMA report TO lab_b;ERROR: 3F000: schema "report" does not exist\dn List of schemas
Name | Owner
---------+-------------------
app | postgres
lab_a | lab_a
lab_b | lab_b
public | pg_database_owner
reports | lab_a
(5 rows)GRANT USAGE ON SCHEMA reports TO lab_b;
GRANT SELECT ON reports.daily TO lab_b;GRANT
GRANTFAQ
How do I fix schema does not exist in PostgreSQL?
Check the real name with \dn (or pg_namespace), then create it, rename it, or fix the spelling. All three fixes were tested on this page.
The schema exists but PostgreSQL says it does not. Why?
It was probably created with quotes in mixed case, like "Sales". Unquoted Sales is read as sales. In the test, pg_namespace showed Sales and the unquoted statement failed.
What is the difference between 3F000 and 42P01?
3F000 is about the schema (for example CREATE TABLE or GRANT ON SCHEMA naming a missing schema). 42P01 is about a missing table or view.
Who can create the schema?
A role with CREATE on the database, such as postgres. In the test postgres ran CREATE SCHEMA ... AUTHORIZATION lab_a so lab_a owned it.
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