GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.postgresql.org — CREATE SCHEMA October 15, 2026: PostgreSQL 19 RC 1 Released!
CREATE SCHEMACREATE SCHEMA — define a new schema SynopsisCREATE SCHEMA Description
A schema is essentially a namespace: it contains named objects (tables, data types, functions, and operators) whose names can duplicate those of other objects existing in other schemas. Named objects are accessed either by “qualifying” their names with the schema name as a prefix, or by setting a search path that includes the desired schema(s). A Optionally, Parameters
NotesTo create a schema, the invoking user must have the ExamplesCreate a schema: CREATE SCHEMA myschema; Create a schema for user CREATE SCHEMA AUTHORIZATION joe; Create a schema named CREATE SCHEMA IF NOT EXISTS test AUTHORIZATION joe; Create a schema and create a table and view within it: CREATE SCHEMA hollywood
CREATE TABLE films (title text, release date, awards text[])
CREATE VIEW winners AS
SELECT title, release FROM films WHERE awards IS NOT NULL;
Notice that the individual subcommands do not end with semicolons. The following is an equivalent way of accomplishing the same result: CREATE SCHEMA hollywood;
CREATE TABLE hollywood.films (title text, release date, awards text[]);
CREATE VIEW hollywood.winners AS
SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL;
CompatibilityThe SQL standard allows a The SQL standard specifies that the subcommands in According to the SQL standard, the owner of a schema always owns all objects within it. PostgreSQL allows schemas to contain objects owned by users other than the schema owner. This can happen only if the schema owner grants the The See AlsoALTER SCHEMA, DROP SCHEMASubmit correctionIf you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |