All Products
Search
Document Center

PolarDB:Rename a partition

Last Updated:Apr 17, 2024

Each partition has their name, and PolarDB for PostgreSQL (Compatible with Oracle) supports the modification of partition names. This topic describes the syntax for renaming partitions and provides a sample statement.

Syntax

ALTER TABLE <table_name> RENAME PARTITION <partition_name> TO <new_name>;
ALTER TABLE <table_name> RENAME SUBPARTITION <subpartition_name> TO <new_name>;

Example

CREATE TABLE hash_partitions_sales (deptno NUMBER, deptname VARCHAR(32))
     PARTITION BY HASH(deptno)
       (PARTITION p1 , PARTITION p2 ,
        PARTITION p3 , PARTITION p4 , PARTITION p5);

ALTER TABLE hash_partitions_sales RENAME PARTITION p1 TO p1_new;