Contents
CREATE SCHEMA
An SQL command for defining a new schema
CREATE SCHEMA
is a DDL command for defining a new schema.
CREATE SCHEMA
was added in PostgreSQL 7.3.
Change history
- PostgreSQL 14
CURRENT_ROLE
available forCREATE SCHEMA [...] AUTHORIZATION ...
(commit 45b98057)
- PostgreSQL 9.5
CURRENT_USER
andSESSION_USER
available forCREATE SCHEMA [...] AUTHORIZATION ...
(commit 31eae602)
- PostgreSQL 9.3
CREATE SCHEMA IF NOT EXISTS
syntax added (commit fb34e94d)
- PostgreSQL 7.3
- added (initial commit 95ef6a34)
Examples
Basic usage example for CREATE SCHEMA
:
postgres=# CREATE SCHEMA foo; CREATE SCHEMA postgres=# \dn List of schemas Name | Owner --------+------------------- foo | postgres public | pg_database_owner (2 rows)
References
- PostgreSQL documentation: CREATE SCHEMA