↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQL Commands

DROP VIEW

remove a view

English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

anchor
SQL-DROPVIEW
file
sql-dropview.html
lang
en
name
DROP VIEW
purpose
remove a view
purpose zh
移除一个视图
sections same as
Unknown
slug
18
synopsis html
DROP VIEW [ IF EXISTS ] <em class="replaceable"><code>name</code></em> [, ...] [ CASCADE | RESTRICT ]
synopsis text
DROP VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

Syntax

DROP VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Syntax diagrams

Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.

DROP VIEW IF EXISTS name , CASCADE RESTRICT

Definition PG 18

DROP VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

Description

DROP VIEW drops an existing view. To execute this command you must be the owner of the view.

Parameters

IF EXISTS

Do not throw an error if the view does not exist. A notice is issued in this case.

name

The name (optionally schema-qualified) of the view to remove.

CASCADE

Automatically drop objects that depend on the view (such as other views), and in turn all objects that depend on those objects (see Section 5.15).

RESTRICT

Refuse to drop the view if any objects depend on it. This is the default.

Examples

This command will remove the view called kinds:

DROP VIEW kinds;

Compatibility

This command conforms to the SQL standard, except that the standard only allows one view to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension.

See Also

ALTER VIEW, CREATE VIEW

Compare versions

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:3671e42214e4d74cf18b4bbbce6231f0b2b12a868df895629b9318506ab5a0d5

Text language: en · wiki-repair-20261023:3671e42214e4d74cf18b4bbbce6231f0b2b12a868df895629b9318506ab5a0d5