Rename PG-FDW's-specific functions to _PG_FDW_
As per review comment.
This commit is contained in:
parent
c4e2549dc8
commit
3a255df9d0
@ -143,7 +143,7 @@ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE;
|
|||||||
-- It does not read from CDB_Conf
|
-- It does not read from CDB_Conf
|
||||||
--
|
--
|
||||||
-- Sample call:
|
-- Sample call:
|
||||||
-- SELECT cartodb.CDB_SetUp_User_Foreign_Server('amazon', '{
|
-- SELECT cartodb.CDB_SetUp_User_PG_FDW_Server('amazon', '{
|
||||||
-- "server": {
|
-- "server": {
|
||||||
-- "extensions": "postgis",
|
-- "extensions": "postgis",
|
||||||
-- "dbname": "testdb",
|
-- "dbname": "testdb",
|
||||||
@ -169,7 +169,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_Foreign_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;
|
||||||
@ -246,10 +246,10 @@ $$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE SECURITY DEFINER;
|
|||||||
-- It does not read from CDB_Conf
|
-- It does not read from CDB_Conf
|
||||||
--
|
--
|
||||||
-- Sample call:
|
-- Sample call:
|
||||||
-- SELECT cartodb.CDB_Drop_User_Foreign_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_Foreign_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);
|
||||||
@ -263,9 +263,9 @@ $$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE SECURITY DEFINER;
|
|||||||
|
|
||||||
-- Set up a user foreign table
|
-- Set up a user foreign table
|
||||||
-- E.g:
|
-- E.g:
|
||||||
-- SELECT cartodb.CDB_SetUp_User_Foreign_Table('amazon', 'carto_lite', 'mytable');
|
-- SELECT cartodb.CDB_SetUp_User_PG_FDW_Table('amazon', 'carto_lite', 'mytable');
|
||||||
-- SELECT * FROM amazon.my_table;
|
-- SELECT * FROM amazon.my_table;
|
||||||
CREATE OR REPLACE FUNCTION @extschema@.CDB_SetUp_User_Foreign_Table(fdw_name NAME, foreign_schema NAME, table_name NAME)
|
CREATE OR REPLACE FUNCTION @extschema@.CDB_SetUp_User_PG_FDW_Table(fdw_name NAME, foreign_schema NAME, table_name NAME)
|
||||||
RETURNS void AS $$
|
RETURNS void AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
EXECUTE FORMAT ('IMPORT FOREIGN SCHEMA %I LIMIT TO (%I) FROM SERVER %I INTO %I;', foreign_schema, table_name, fdw_name, fdw_name);
|
EXECUTE FORMAT ('IMPORT FOREIGN SCHEMA %I LIMIT TO (%I) FROM SERVER %I INTO %I;', foreign_schema, table_name, fdw_name, fdw_name);
|
||||||
|
@ -607,10 +607,10 @@ test_extension|public|"local-table-with-dashes"'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
sql cdb_testmember_1 "SELECT cartodb.CDB_SetUp_User_Foreign_Server('test_user_fdw', '$ufdw_config');"
|
sql cdb_testmember_1 "SELECT cartodb.CDB_SetUp_User_PG_FDW_Server('test_user_fdw', '$ufdw_config');"
|
||||||
|
|
||||||
# Set up a user foreign table
|
# Set up a user foreign table
|
||||||
sql cdb_testmember_1 "SELECT cartodb.CDB_SetUp_User_Foreign_Table('test_user_fdw', 'test_fdw', 'foo');"
|
sql cdb_testmember_1 "SELECT cartodb.CDB_SetUp_User_PG_FDW_Table('test_user_fdw', 'test_fdw', 'foo');"
|
||||||
|
|
||||||
# Check that the table can be accessed by the owner/creator
|
# Check that the table can be accessed by the owner/creator
|
||||||
sql cdb_testmember_1 "SELECT * from test_user_fdw.foo;"
|
sql cdb_testmember_1 "SELECT * from test_user_fdw.foo;"
|
||||||
@ -638,9 +638,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 cdb_testmember_1 "SELECT cartodb.CDB_Drop_User_Foreign_Server('test_user_fdw')" fails
|
sql cdb_testmember_1 "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 cdb_testmember_1 "SELECT cartodb.CDB_Drop_User_Foreign_Server('test_user_fdw')"
|
sql cdb_testmember_1 "SELECT cartodb.CDB_Drop_User_PG_FDW_Server('test_user_fdw')"
|
||||||
|
|
||||||
|
|
||||||
# Teardown
|
# Teardown
|
||||||
|
Loading…
Reference in New Issue
Block a user