Query below lists all schemas in PostgreSQL database. Schemas include default pg_* , information_schema and temporary schemas.
If you want to list user only schemas use this script.
select s.nspname as table_schema, s.oid as schema_id, u.usename as owner from pg_catalog.pg_namespace s join pg_catalog.pg_user u on u.usesysid = s.nspowner order by table_schema;
- table_schema - schema name
- schema_id - schema id, unique within the database
- owner - principal that owns this schema
- One row represents one schema in a database
- Scope of rows: all schemas in a database, including default ones
- Ordered by schema name
Here is a view of database schemas in pgAdmin (marked in blue - user schemas, marked in red - system schemas):