Set owner of overlays to the owner of the base table
This commit is contained in:
parent
cecba655eb
commit
08828b8b7d
@ -221,12 +221,14 @@ RETURNS VOID
|
|||||||
AS $$
|
AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
sql TEXT;
|
sql TEXT;
|
||||||
|
table_owner TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
IF current_user != session_user THEN
|
-- preserve the owner of the base table
|
||||||
sql := Format('ALTER TABLE IF EXISTS %s OWNER TO %s', overview_table::text, session_user);
|
SELECT u.usename
|
||||||
EXECUTE sql;
|
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_user u ON (c.relowner=u.usesysid)
|
||||||
END IF;
|
WHERE c.relname = dataset::text
|
||||||
|
INTO table_owner;
|
||||||
|
EXECUTE Format('ALTER TABLE IF EXISTS %s OWNER TO %I', overview_table::text, table_owner);
|
||||||
PERFORM _CDB_Add_Indexes(overview_table);
|
PERFORM _CDB_Add_Indexes(overview_table);
|
||||||
|
|
||||||
-- TODO: we'll need to store metadata somewhere to define
|
-- TODO: we'll need to store metadata somewhere to define
|
||||||
|
Loading…
Reference in New Issue
Block a user