DROP_SCHEMA(7pg17)
π
DROP_SCHEMA(7) β remove a schema, bestie π
πΈ NAME πΈ
DROP_SCHEMA β remove a schema. thatβs the whole vibe, no cap.
β¨ SYNOPSIS β¨
okay so hereβs the syntax, bestie:
DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
π¦ DESCRIPTION π¦
so DROP_SCHEMA literally removes schemas from the database. iconic.
only the schemaβs owner or a superuser can drop it. and yes, the owner can drop the schema β and by extension all contained objects β even if they donβt own some of the objects within the schema. the way that works is lowkey wild, but thatβs the rule π
π PARAMETERS π
IF EXISTSβ donβt throw an error if the schema doesnβt exist. a notice is issued in this case.nameβ the name of a schema.CASCADEβ auto-drops objects (tables, functions, etc.) contained in the schema, and then all objects that depend on those objects (see Section 5.15).RESTRICTβ refuse to drop the schema if it contains any objects. this is the default, bestie.
β NOTES β
heads up: using CASCADE might make the command remove objects in other schemas besides the one(s) you named. so likeβ¦ be aware π
π EXAMPLES π
to remove schema mystuff from the database, along with everything it contains:
DROP SCHEMA mystuff CASCADE;
π COMPATIBILITY π
compatibility check, bestie: DROP_SCHEMA is fully conforming with the SQL standard β with two caveats: the standard only allows one schema to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension. iykyk.
π SEE ALSO π
ALTER SCHEMA(ALTER_SCHEMA(7))CREATE SCHEMA(CREATE_SCHEMA(7))
π thatβs the whole DROP_SCHEMA tea β PostgreSQL 17.11, dated 2026. mwah, go be iconic with your schemas π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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