From 5b47c512210fd38554edb8d3d36603f823bb26fc Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Tue, 12 Jan 2016 15:35:50 +0100 Subject: [PATCH] Add function to drop overviews --- scripts-available/CDB_Overviews.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts-available/CDB_Overviews.sql b/scripts-available/CDB_Overviews.sql index 83e29ea..e25875b 100644 --- a/scripts-available/CDB_Overviews.sql +++ b/scripts-available/CDB_Overviews.sql @@ -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 -- Scope: public -- Parameters