DROP_SCHEMA(7pg13)
πΈ NAME πΈ
okay so this page is DROP_SCHEMA(7pg13) from the PostgreSQL 13.23 docs, and itβs literally about removing a schema from the database. no cap. π
β¨ SYNOPSIS β¨
DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
π DESCRIPTION π
DROP SCHEMA removes schemas from the database. thatβs the whole vibe. π«Ά
A schema can only be dropped by its owner or a superuser. main character permissions only, bestie. β¨ Note that the owner can drop the schema (and thereby all contained objects) even if they do not own some of the objects within the schema. like, yes, thatβs a thing. π
π PARAMETERS π
IF EXISTSβ do not throw an error if the schema does not exist. A notice is issued in this case. πnameβ the name of a schema. simple as that. πCASCADEβ automatically drop objects (tables, functions, etc.) that are contained in the schema, and in turn all objects that depend on those objects (see Section 5.14). this one goes hard, so be careful. π₯RESTRICTβ refuse to drop the schema if it contains any objects. this is the default. π
π¦ NOTES π¦
Using the CASCADE option might make the command remove objects in other schemas besides the one(s) named. not a drill, bestie. lowkey sneaky. π
π EXAMPLES π
To remove schema mystuff from the database, along with everything it contains:
DROP SCHEMA mystuff CASCADE;
β COMPATIBILITY β
DROP SCHEMA is fully conforming with the SQL standard, except that the standard only allows one schema to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension. slay for standards compliance, with one tiny asterisk. β
π₯ SEE ALSO π₯
ALTER SCHEMA(ALTER_SCHEMA(7))CREATE SCHEMA(CREATE_SCHEMA(7))
xoxo, PostgreSQL 13.23, 2025 β DROP_SCHEMA(7) out. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms