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:
schema_name.table_name: The name of the analytical schema containing the analytical table to delete, followed by the table name itself.You can omit the schema name and simply specify the table name (without a dot). In this case, the default
mainanalytical schema is used.force: Specifies whether to drop the Postgres Pro view created from the analytical table using themetastore.create_viewstored procedure.Possible values:
truefalse
Default value:
true.Optional parameter.
cascade: Specifies whether to drop all views based on the Postgres Pro view created from the analytical table using themetastore.create_viewstored procedure.Possible values:
truefalse
Default value:
false.Optional parameter.
Postgres Pro AXE performs the following actions:
Verifies input parameters and user privileges.
Creates a new entry in the
pga_snapshotmetadata table and sets theend_snapshotvalue for the analytical table in thepga_tablemetadata table.Sets the
end_snapshotvalue for entries associated with the analytical table in other metadata tables.Performs actions depending on
forceandcascadevalues (refer to the table below).forcecascadeAction falsefalseNo actions are performed, and views remain unchanged. falsetrueDrops the view and all views based on it. The cascadeflag is applied,forceis ignored.truefalseOnly drops the view. If there are views based on this view, outputs an SQL error. truetrueDrops the view and all views based on it. The cascadeflag is applied,forceis 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