PostgreSQL schemas and search_path
Short answer
A database holds one or more named schemas, and schemas hold tables and other objects, like folders. If you do not name a schema, objects go into public.
CREATE SCHEMA IF NOT EXISTS app AUTHORIZATION app_owner;
CREATE TABLE app.users (id bigint);
SET search_path TO app, public;
[S2]
Schemas let several users or apps share one database without name clashes and limit each to its own namespace. [S1]
Claims
- id: C1 claim: A database contains one or more named schemas containing tables. source: S1 evidence: "A database contains one or more named schemas, which in turn contain tables."
- id: C2 claim: Tables without a schema name go into the public schema. source: S1 evidence: "automatically put into a schema named “public”"
- id: C3 claim: CREATE SCHEMA supports IF NOT EXISTS with AUTHORIZATION. source: S2 evidence: "CREATE SCHEMA IF NOT EXISTS schema_name [ AUTHORIZATION role_specification ]"
Sources
- [S1] PostgreSQL: Documentation: 18: 5.10. Schemas. PostgreSQL Global Development Group. https://www.postgresql.org/docs/current/ddl-schemas.html . License: PostgreSQL License. Accessed 2026-11-04.
- [S2] PostgreSQL: Documentation: 18: CREATE SCHEMA. PostgreSQL Global Development Group. https://www.postgresql.org/docs/current/sql-createschema.html . License: PostgreSQL License. Accessed 2026-11-04.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: PostgreSQL Global Development Group, PostgreSQL: Documentation: 18: 5.10. Schemas, PostgreSQL License; PostgreSQL Global Development Group, PostgreSQL: Documentation: 18: CREATE SCHEMA, PostgreSQL License.
Cite this
iinventedlight. 2026. "PostgreSQL schemas and search_path." iinventedlight Library, iil:note:ek65tbsj, version of 2026-11-04. https://iinventedlight.com/library/notes/postgres-schemas/. License: CC-BY-4.0.
@misc{iil_note_ek65tbsj,
author = {{iinventedlight}},
title = {{PostgreSQL schemas and search\_path}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/postgres-schemas/},
note = {Permanent ID iil:note:ek65tbsj. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/postgres-schemas.md.