From 496f079b1c8d2f3d355a8140e204fb6bbba3e940 Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Mon, 4 Jan 2016 18:06:56 +0100 Subject: [PATCH] Copy dataset privileges to overview tables --- scripts-available/CDB_Overviews.sql | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts-available/CDB_Overviews.sql b/scripts-available/CDB_Overviews.sql index aaadf45..650a73c 100644 --- a/scripts-available/CDB_Overviews.sql +++ b/scripts-available/CDB_Overviews.sql @@ -228,7 +228,15 @@ AS $$ FROM pg_catalog.pg_class c JOIN pg_catalog.pg_user u ON (c.relowner=u.usesysid) WHERE c.relname = dataset::text INTO table_owner; - EXECUTE Format('ALTER TABLE IF EXISTS %s OWNER TO %I', overview_table::text, table_owner); + EXECUTE Format('ALTER TABLE IF EXISTS %s OWNER TO %I;', overview_table::text, table_owner); + + -- preserve the table privileges + UPDATE pg_class c_to + SET relacl = c_from.relacl + FROM pg_class c_from + WHERE c_from.oid = dataset + AND c_to.oid = overview_table; + PERFORM _CDB_Add_Indexes(overview_table); -- TODO: we'll need to store metadata somewhere to define