Reuser creator_role

Co-Authored-By: Alberto Romeu <alrocar@users.noreply.github.com>
This commit is contained in:
Mario de Frutos Dieguez 2019-07-04 11:26:26 +02:00
parent f4be59cae0
commit 8ecd2cd5e2
No known key found for this signature in database
GPG Key ID: C9738009A2E89223

View File

@ -17,7 +17,7 @@ BEGIN
obj.schema_name,
obj.object_identity;
SELECT rolname FROM pg_class JOIN pg_roles ON relowner = pg_roles.oid WHERE pg_class.oid = obj.objid INTO creator_role;
SELECT value->>'ownership_role_name' from cdb_conf where key = (SELECT 'api_keys_' || rolname FROM pg_class JOIN pg_roles ON relowner = pg_roles.oid WHERE pg_class.oid = obj.objid) INTO owner_role;
SELECT value->>'ownership_role_name' from cdb_conf where key = 'api_keys_' || creator_role INTO owner_role;
IF owner_role IS NULL THEN
CONTINUE;
ELSE