Postgres Plus Advanced Server Oracle Compatibility Developer's Guide : 12.9 ALTER TABLE… TRUNCATE SUBPARTITION

Previous PageTable Of ContentsNext Page

Postgres Plus Advanced Server Oracle Compatibility Developer's Guide

 

12.9 ALTER TABLE… TRUNCATE SUBPARTITION

Use the ALTER TABLETRUNCATE SUBPARTITION command to remove all of the data from the specified subpartition, leaving the subpartition structure intact. The syntax is:

      ALTER TABLE table_name
      TRUNCATE SUBPARTITION subpartition_name
      [{DROP|REUSE} STORAGE]

Description

Use the ALTER TABLETRUNCATE SUBPARTITION command to remove all of the data from the specified subpartition, leaving the subpartition structure intact.

ALTER TABLETRUNCATE SUBPARTITION will not cause ON DELETE triggers that might exist for the table to fire, but it will fire ON TRUNCATE triggers. If an ON TRUNCATE trigger is defined for the subpartition, all BEFORE TRUNCATE triggers are fired before any truncation happens, and all AFTER TRUNCATE triggers are fired after the last truncation occurs. You must have the TRUNCATE privilege on a table to invoke ALTER TABLETRUNCATE SUBPARTITION.

For more information about restrictions that apply to the ALTER TABLETRUNCATE SUBPARTITION, please refer to the TRUNCATE command, in the PostgreSQL Core documentation at:

Parameters

table_name

The name (optionally schema-qualified) of the modified table.

subpartition_name

The name of the subpartition to be truncated.

DROP STORAGE and REUSE STORAGE are included for compatibility only; the clauses are parsed and ignored.

Example

To remove all of the data from the staff subpartition of the employees table, invoke the following command:

      ALTER TABLE employees TRUNCATE PARTITION staff;

      Previous PageTable Of ContentsNext Page