25.4. Deleting an Analytical Table (metastore.remove_table) #

Required privileges: Postgres Pro AXE administrator only. For more information about stored procedures and privileges, refer to Section 22.1.

Execute the following command:

  SELECT metastore.remove_table('schema_name.table_name', --[force], [cascade]);

Where:

Postgres Pro AXE performs the following actions:

  1. Verifies input parameters and user privileges.

  2. Creates a new entry in the pga_snapshot metadata table and sets the end_snapshot value for the analytical table in the pga_table metadata table.

  3. Sets the end_snapshot value for entries associated with the analytical table in other metadata tables.

  4. Performs actions depending on force and cascade values (refer to the table below).

    forcecascadeAction

    false

    false

    No actions are performed, and views remain unchanged.

    false

    true

    Drops the view and all views based on it. The cascade flag is applied, force is ignored.

    true

    false

    Only drops the view. If there are views based on this view, outputs an SQL error.

    true

    true

    Drops the view and all views based on it. The cascade flag is applied, force is ignored.

Example 25.6. Executing the metastore.remove_table stored procedure

  SELECT metastore.remove_table('table_example'); --force=true, cascade=false
  SELECT metastore.remove_table('table_example', false); --force=false, cascade=false
  SELECT metastore.remove_table('table_name', false, true); --force=false, cascade=true