Add function to drop overviews

This commit is contained in:
Javier Goizueta 2016-01-12 15:35:50 +01:00
parent ebaded0c7a
commit 5b47c51221

View File

@ -1,3 +1,18 @@
CREATE OR REPLACE FUNCTION CDB_DropOverviews(reloid REGCLASS)
RETURNS void
AS $$
DECLARE
row record;
BEGIN
FOR row IN
SELECT * FROM CDB_Overviews(reloid)
LOOP
EXECUTE Format('DROP TABLE %I;', row.overview_table);
RAISE NOTICE 'Dropped overview for level %: %', row.z, row.overview_table;
END LOOP;
END;
$$ LANGUAGE PLPGSQL VOLATILE;
-- Return existing overviews (if any) for a given dataset table -- Return existing overviews (if any) for a given dataset table
-- Scope: public -- Scope: public
-- Parameters -- Parameters