16.4. Deleting an Analytical Table (metastore.remove_table) #
Required privileges: Postgres Pro AXE administrator only. For a full list of stored procedures and privileges, refer to Section 12.1.
Execute the following command on the Postgres Pro AXE server:
SELECT metastore.remove_table('schema_name.table_name', --[force], [cascade]) ON CONFLICT DO NOTHING;
Where:
schema_name.table_name: The name of the analytical schema containing the analytical table that must be deleted, 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 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 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:
Checks input parameters and user privileges.
Creates a new entry in the
pga_snapshotmetadata table and sets theend_snapshotfield for the analytical table in thepga_tablemetadata table.Sets the
end_snapshotfield 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 ignoredtruefalseOnly drops the view. If there are views based on this view, returns an SQL error
truetrueDrops the view and all views based on it. The
cascadeflag is applied,forceis ignored
Example 16.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