DROP_TABLE(7pg14)
π NAME π
okay so bestie, this is the DROP_TABLE(7pg14) page β aka DROP TABLE β and it's literally about how to remove a table from your PostgreSQL 14.24 database. π
β¨ SYNOPSIS β¨
DROP TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
π DESCRIPTION π
DROP TABLE removes tables from the database, no cap. Only the table owner, the schema owner, and superuser can drop a table. If you just wanna empty a table of rows without destroying the table itself, use DELETE or TRUNCATE instead. slay. πΈ
DROP TABLE always removes any indexes, rules, triggers, and constraints that exist for the target table. Iconic cleanup energy. But if you need to drop a table that's referenced by a view or a foreign-key constraint of another table, you must specify CASCADE. (And here's the tea: CASCADE will remove a dependent view entirely, but in the foreign-key case it will only remove the foreign-key constraint β not the other table entirely.) π
π¦ PARAMETERS π¦
IF EXISTSβ do not throw an error if the table does not exist. A notice is issued in this case. πnameβ the name (optionally schema-qualified) of the table to drop. πCASCADEβ automatically drop objects that depend on the table (such as views), and in turn all objects that depend on those objects (see Section 5.14). π₯RESTRICTβ refuse to drop the table if any objects depend on it. This is the default. π
π EXAMPLES π
To destroy two tables, films and distributors:
DROP TABLE films, distributors;
β COMPATIBILITY β
This command conforms to the SQL standard, except that the standard only allows one table to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension. periodt. β¨
π SEE ALSO π
ALTER TABLE(ALTER_TABLE(7))CREATE TABLE(CREATE_TABLE(7))
π«Ά that's the whole DROP_TABLE(7pg14) situation, bestie! source/version: PostgreSQL 14.24 Β· date: 2026 Β· now go drop tables responsibly π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-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