From 3a255df9d0081da3068f872ae23466d456231162 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 16 Jul 2019 13:14:11 +0200 Subject: [PATCH] Rename PG-FDW's-specific functions to _PG_FDW_ As per review comment. --- scripts-available/CDB_ForeignTable.sql | 12 ++++++------ test/extension/test.sh | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts-available/CDB_ForeignTable.sql b/scripts-available/CDB_ForeignTable.sql index d48465b..ae86b87 100644 --- a/scripts-available/CDB_ForeignTable.sql +++ b/scripts-available/CDB_ForeignTable.sql @@ -143,7 +143,7 @@ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE; -- It does not read from CDB_Conf -- -- Sample call: --- SELECT cartodb.CDB_SetUp_User_Foreign_Server('amazon', '{ +-- SELECT cartodb.CDB_SetUp_User_PG_FDW_Server('amazon', '{ -- "server": { -- "extensions": "postgis", -- "dbname": "testdb", @@ -169,7 +169,7 @@ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE; -- * Specific roles: GRANT amazon TO role_name; -- * Members of the organization: SELECT cartodb.CDB_Organization_Grant_Role('amazon'); -- * 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 $$ DECLARE row record; @@ -246,10 +246,10 @@ $$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE SECURITY DEFINER; -- It does not read from CDB_Conf -- -- 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 -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 $$ BEGIN EXECUTE FORMAT ('DROP SCHEMA %I', fdw_name); @@ -263,9 +263,9 @@ $$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE SECURITY DEFINER; -- Set up a user foreign table -- 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; -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 $$ BEGIN EXECUTE FORMAT ('IMPORT FOREIGN SCHEMA %I LIMIT TO (%I) FROM SERVER %I INTO %I;', foreign_schema, table_name, fdw_name, fdw_name); diff --git a/test/extension/test.sh b/test/extension/test.sh index ffe2ba3..4d3ea2d 100755 --- a/test/extension/test.sh +++ b/test/extension/test.sh @@ -607,10 +607,10 @@ test_extension|public|"local-table-with-dashes"' } } 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 - 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 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;" # 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 "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