Share via


DROP CATALOG

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 10.4 LTS and above check marked yes Unity Catalog only

Drops a catalog. An exception is thrown if the catalog does not exist in the metastore. To drop a catalog you must have the MANAGE privilege on the catalog or be its owner.

Syntax

DROP CATALOG [ IF EXISTS ] catalog_name [ RESTRICT | CASCADE ]

Parameters

  • IF EXISTS

    If specified, no exception is thrown when the catalog does not exist.

  • catalog_name:

    The name of an existing catalog in the metastore. If the name does not exist, an exception is thrown.

  • RESTRICT

    If specified, restricts dropping a non-empty catalog. Enabled by default.

  • CASCADE

    If specified, drops all of the associated databases (schemas) and the objects within them, recursively. In Unity Catalog, dropping a catalog using CASCADE soft-deletes tables: managed table files will be cleaned up within 7 to 30 days, but external files are not deleted.

Examples

-- Create a `vaccine` catalog
> CREATE CATALOG vaccine COMMENT 'This catalog is used to maintain information about vaccines';

-- Drop the catalog and its schemas
> DROP CATALOG vaccine CASCADE;

-- Drop the catalog using IF EXISTS and only if it is empty.
> DROP CATALOG IF EXISTS vaccine RESTRICT;

Additional resources

Training

Module

Use system catalogs and system views in PostgreSQL - Training

Relational databases can store vast quantities of data, but they also need to hold information about the structure of that data. For an operational database management system (DBMS) information about the structure of tables, and all other objects, security, and concurrency, amongst many other settings and metrics, is required. This information is know as metadata and is stored in system catalogs in Azure Database for PostgreSQL. In addition to directly accessing system catalogs, you can access system views