Delete a partitioned table

Updated at:

You delete a partitioned table and all of its partitions. This topic describes the statement and examples for deleting a partitioned table.

Syntax

DROP [ TABLE ] name [ CASCADE | RESTRICT ]

The DROP TABLE statement deletes a table from a database. To clear rows in a table without deleting the table, execute the DELETE or TRUNCATE statement.

The DROP TABLE statement deletes all indexes, rules, triggers, and constraints in the table. To delete a table referenced by a view or a foreign key constraint of another table, you must use CASCADE.

Note
  • Only the table owner, schema owner, or superuser can delete a table.

  • The statement to delete a partitioned table in PolarDB for PostgreSQL is fully compatible with PostgreSQL. For more information about the syntax of DROP TABLE, see PostgreSQL documentation.

Example

Delete partitioned table tab_range.

DROP TABLE tab_range;