From ae634e7814bfe39c3c74598a35b0f4400e69a682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Fri, 14 Aug 2015 15:04:14 +0200 Subject: [PATCH] Server notification must happen after role creation --- scripts-available/CDB_Groups.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts-available/CDB_Groups.sql b/scripts-available/CDB_Groups.sql index e036531..31b0145 100644 --- a/scripts-available/CDB_Groups.sql +++ b/scripts-available/CDB_Groups.sql @@ -6,8 +6,8 @@ DECLARE group_role TEXT; BEGIN group_role := cartodb._CDB_Group_GroupRole(group_name); - PERFORM cartodb._CDB_Group_CreateGroup_API(current_database(), group_name, group_role); EXECUTE 'CREATE ROLE "' || group_role || '" NOLOGIN;'; + PERFORM cartodb._CDB_Group_CreateGroup_API(current_database(), group_name, group_role); END $$ LANGUAGE PLPGSQL VOLATILE; @@ -23,9 +23,9 @@ DECLARE cdb_group_role TEXT; BEGIN cdb_group_role := cartodb._CDB_Group_GroupRole(group_name); - PERFORM cartodb._CDB_Group_DropGroup_API(current_database(), group_name); EXECUTE 'DROP OWNED BY "' || cdb_group_role || '"'; EXECUTE 'DROP ROLE IF EXISTS "' || cdb_group_role || '"'; + PERFORM cartodb._CDB_Group_DropGroup_API(current_database(), group_name); END $$ LANGUAGE PLPGSQL VOLATILE;