---
source: https://iinventedlight.com/library/notes/postgres-schemas.md
title: "PostgreSQL schemas and search_path"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PostgreSQL License; prose restates cited source lines"
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: PostgreSQL"
tags: postgresql, schemas, search-path
sources:
  - id: S1
    title: "PostgreSQL: Documentation: 18: 5.10. Schemas"
    publisher: PostgreSQL Global Development Group
    url: https://www.postgresql.org/docs/current/ddl-schemas.html
    accessed: 2026-11-04
    license: "PostgreSQL License"
  - id: S2
    title: "PostgreSQL: Documentation: 18: CREATE SCHEMA"
    publisher: PostgreSQL Global Development Group
    url: https://www.postgresql.org/docs/current/sql-createschema.html
    accessed: 2026-11-04
    license: "PostgreSQL License"
---
# 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`.

```sql
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).
