Created
July 13, 2017 17:51
-
-
Save jakeemerson/4e0ede5b5d67b50ee049093de1c97454 to your computer and use it in GitHub Desktop.
Update AWS RDS to give the rds_superuser role ownership of the topology schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO | |
$BODY$ | |
DECLARE | |
_sql text; | |
BEGIN | |
EXECUTE 'SET search_path = topology,public;'; | |
EXECUTE 'ALTER SCHEMA topology OWNER TO rds_superuser;'; | |
EXECUTE 'ALTER TABLE topology.topology OWNER TO rds_superuser;'; | |
EXECUTE 'ALTER TABLE topology.topology_id_seq OWNER TO rds_superuser;'; | |
EXECUTE 'ALTER SEQUENCE topology.topology_id_seq OWNER TO rds_superuser;'; | |
EXECUTE 'ALTER TABLE topology.layer OWNER TO rds_superuser;'; | |
SELECT INTO _sql | |
string_agg('ALTER FUNCTION ' | |
|| nsp.nspname || '.' | |
|| p.proname || '(' | |
|| pg_get_function_identity_arguments(p.oid) | |
|| ') OWNER TO rds_superuser;', E'\n' | |
) | |
FROM pg_catalog.pg_proc p | |
JOIN pg_catalog.pg_namespace nsp ON p.pronamespace = nsp.oid | |
WHERE nsp.nspname = 'topology'; | |
EXECUTE _sql; | |
END | |
$BODY$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment