All Products
Search
Document Center

Hologres:DROP SCHEMA

Last Updated:Mar 26, 2026

DROP SCHEMA removes one or more schemas from the current database, along with their objects if CASCADE is specified.

Limits

  • You cannot drop the default public schema.

Syntax

DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
ParameterDescription
IF EXISTSSuppresses an error if the schema does not exist. Use this clause in scripts so the statement does not fail when run against a nonexistent schema.
CASCADEDrops the schema and all objects it contains, such as tables and functions.
RESTRICTRefuses to drop the schema if it contains any objects. This is the default.

Examples

Drop a schema only if it is empty. If the schema contains any objects, the statement returns an error:

DROP SCHEMA mystuff RESTRICT;

Drop a schema and all its objects. Use this with caution in production environments:

DROP SCHEMA mystuff CASCADE; -- Replace mystuff with the name of your schema.

Drop a schema if it exists, or do nothing if it does not. This is safe to use in automation scripts:

DROP SCHEMA IF EXISTS mystuff;