Prepend an underscore (_) to functions meant to be run by superuser
_CDB_SetUp_User_PG_FDW_Server and _CDB_Drop_User_PG_FDW_Server are meant to be executed by a superuser. Therefore they shouldn't be considered part of the public API and hence the _CDB_Private_Function naming convention.
This commit is contained in:
parent
a32dea0282
commit
0f33ee8b22
@ -170,7 +170,7 @@ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE;
|
|||||||
-- * Specific roles: GRANT amazon TO role_name;
|
-- * Specific roles: GRANT amazon TO role_name;
|
||||||
-- * Members of the organization: SELECT cartodb.CDB_Organization_Grant_Role('amazon');
|
-- * Members of the organization: SELECT cartodb.CDB_Organization_Grant_Role('amazon');
|
||||||
-- * The publicuser: GRANT amazon TO publicuser;
|
-- * The publicuser: GRANT amazon TO publicuser;
|
||||||
CREATE OR REPLACE FUNCTION @extschema@.CDB_SetUp_User_PG_FDW_Server(fdw_name NAME, config json)
|
CREATE OR REPLACE FUNCTION @extschema@._CDB_SetUp_User_PG_FDW_Server(fdw_name NAME, config json)
|
||||||
RETURNS void AS $$
|
RETURNS void AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
row record;
|
row record;
|
||||||
@ -248,7 +248,7 @@ $$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE;
|
|||||||
-- SELECT cartodb.CDB_Drop_User_PG_FDW_Server('amazon')
|
-- SELECT cartodb.CDB_Drop_User_PG_FDW_Server('amazon')
|
||||||
--
|
--
|
||||||
-- Note: if there's any dependent object (i.e. foreign table) this call will fail
|
-- Note: if there's any dependent object (i.e. foreign table) this call will fail
|
||||||
CREATE OR REPLACE FUNCTION @extschema@.CDB_Drop_User_PG_FDW_Server(fdw_name NAME)
|
CREATE OR REPLACE FUNCTION @extschema@._CDB_Drop_User_PG_FDW_Server(fdw_name NAME)
|
||||||
RETURNS void AS $$
|
RETURNS void AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
EXECUTE FORMAT ('DROP SCHEMA %I', fdw_name);
|
EXECUTE FORMAT ('DROP SCHEMA %I', fdw_name);
|
||||||
|
@ -607,7 +607,7 @@ test_extension|public|"local-table-with-dashes"'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
sql postgres "SELECT cartodb.CDB_SetUp_User_PG_FDW_Server('test_user_fdw', '$ufdw_config');"
|
sql postgres "SELECT cartodb._CDB_SetUp_User_PG_FDW_Server('test_user_fdw', '$ufdw_config');"
|
||||||
|
|
||||||
# Grant a user access to that FDW, and to grant to others
|
# Grant a user access to that FDW, and to grant to others
|
||||||
sql postgres "GRANT test_user_fdw TO cdb_testmember_1 WITH ADMIN OPTION;"
|
sql postgres "GRANT test_user_fdw TO cdb_testmember_1 WITH ADMIN OPTION;"
|
||||||
@ -641,9 +641,9 @@ EOF
|
|||||||
sql cdb_testmember_1 "REVOKE test_user_fdw FROM publicuser;"
|
sql cdb_testmember_1 "REVOKE test_user_fdw FROM publicuser;"
|
||||||
|
|
||||||
# If there are dependent objects, we cannot drop the foreign server
|
# If there are dependent objects, we cannot drop the foreign server
|
||||||
sql postgres "SELECT cartodb.CDB_Drop_User_PG_FDW_Server('test_user_fdw')" fails
|
sql postgres "SELECT cartodb._CDB_Drop_User_PG_FDW_Server('test_user_fdw')" fails
|
||||||
sql cdb_testmember_1 "DROP FOREIGN TABLE test_user_fdw.foo;"
|
sql cdb_testmember_1 "DROP FOREIGN TABLE test_user_fdw.foo;"
|
||||||
sql postgres "SELECT cartodb.CDB_Drop_User_PG_FDW_Server('test_user_fdw')"
|
sql postgres "SELECT cartodb._CDB_Drop_User_PG_FDW_Server('test_user_fdw')"
|
||||||
|
|
||||||
|
|
||||||
# Teardown
|
# Teardown
|
||||||
|
Loading…
Reference in New Issue
Block a user