Back to Materialize

DROP OWNED

doc/user/content/sql/drop-owned.md

1231.5 KB
Original Source

DROP OWNED drops all the objects that are owned by one of the specified roles. Any privileges granted to the given roles on objects will also be revoked.

{{< note >}} Unlike PostgreSQL, Materialize drops all objects across all databases, including the database itself. {{< /note >}}

Syntax

mzsql
DROP OWNED BY <role_name> [, ...] [RESTRICT|CASCADE];
Syntax elementDescription
<role_name>The role name whose owned objects will be dropped.
CASCADEOptional. If specified, remove all dependent objects.
RESTRICTOptional. Do not drop anything if any non-index objects depencies exist. (Default.)

Examples

mzsql
DROP OWNED BY joe;
mzsql
DROP OWNED BY joe, george CASCADE;

Privileges

The privileges required to execute this statement are:

{{% include-headless "/headless/sql-command-privileges/drop-owned" %}}