Drop Rule

Removes a rule from a database.

Synopsis

DROP RULE name [, ...]

Parameters

name

The name of an existing rule to drop. You may drop multiple rules by specifying their names in a comma-delimited list.

Results

DROP

The message returned when a rule is dropped successfully.

ERROR: Rule or view "name" not found

The error returned if the specified rule name does not exist.

Description

Use the DROP RULE command to remove a rule from a PostgreSQL database. When a rule is dropped, the change is effective immediately. A rule becomes unavailable as soon as it is dropped, and its definition is completely removed from the database system.

Example

The following example drops the sync_stock_with_editions rule:

booktown=# DROP RULE sync_stock_with_editions;
DROP

Get Practical PostgreSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.