← All notes

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

Sources

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

Permanent ID: iil:note:ek65tbsj

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.},
}

Markdown

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.