DROP_VIEW(7pg17)
π NAME π
omg bestie, this one is DROP_VIEW β aka DROP VIEW(7) β and it removes a view. Slay, but also be careful, because dropping things is very main-character energy. π
β¨ SYNOPSIS β¨
DROP VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
π DESCRIPTION π
DROP VIEW drops an existing view. Thatβs the whole vibe. But no cap: to run this command you must be the owner of the view. π
π¦ PARAMETERS π¦
IF EXISTSβ do not throw an error if the view does not exist. In that case, a notice is issued. So itβs like βbestie, if itβs not there, donβt scream, just let it go.β π«Άnameβ the name of the view to remove. It can optionally be schema-qualified. Literally the target of the drop. π―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. Itβs giving βconsequences? yes, automatically.β ππ₯RESTRICTβ refuse to drop the view if any objects depend on it. This is the default. So by default itβs like βnope, something still needs you, weβre not doing this.β π
πΈ EXAMPLES πΈ
This command will remove the view called kinds:
DROP VIEW kinds;
iconic. short. effective. periodt. β¨
π 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. So yes, mostly standard, with a lil PostgreSQL flair. π
π₯ SEE ALSO π₯
ALTER VIEW (ALTER_VIEW(7))CREATE VIEW (CREATE_VIEW(7))
go read those too, bestie, iykyk π§π
cute lil sign-off: this page is from the PostgreSQL 17.11 Documentation, dated 2026. mwah ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms