Rename private functions

Rename __cdb_* "private" functions to __ft_*, kind of a namespace to
avoid name clashing.
pg-federated-server-setup
Rafa de la Torre 5 years ago
parent df396bf41f
commit e9b3144390

@ -4,7 +4,7 @@
-- Take a config jsonb and transform it to an input suitable for
-- _CDB_SetUp_User_PG_FDW_Server
CREATE OR REPLACE FUNCTION @extschema@.__cdb_credentials_to_user_mapping(input_config jsonb)
CREATE OR REPLACE FUNCTION @extschema@.__ft_credentials_to_user_mapping(input_config jsonb)
RETURNS jsonb
AS $$
DECLARE
@ -24,7 +24,7 @@ LANGUAGE PLPGSQL IMMUTABLE PARALLEL SAFE;
-- Take a config jsonb as input and return it augmented with default
-- options
CREATE OR REPLACE FUNCTION @extschema@.__cdb_add_default_options(input_config jsonb)
CREATE OR REPLACE FUNCTION @extschema@.__ft_add_default_options(input_config jsonb)
RETURNS jsonb
AS $$
DECLARE
@ -63,8 +63,8 @@ AS $$
DECLARE
final_config jsonb;
BEGIN
final_config := @extschema@.__cdb_credentials_to_user_mapping(
@extschema@.__cdb_add_default_options(server_config)
final_config := @extschema@.__ft_credentials_to_user_mapping(
@extschema@.__ft_add_default_options(server_config)
);
PERFORM cartodb._CDB_SetUp_User_PG_FDW_Server(server_alias, final_config::json);
END

@ -690,7 +690,7 @@ function test_federated_tables() {
}
EOF
# Unit-test __cdb_credentials_to_user_mapping
# Unit-test __ft_credentials_to_user_mapping
read -d '' expected_user_mapping <<- EOF
{
"server": {
@ -704,10 +704,10 @@ EOF
}
}
EOF
sql postgres "SELECT cartodb.__cdb_credentials_to_user_mapping('$federated_server_config') = '$expected_user_mapping'" \
sql postgres "SELECT cartodb.__ft_credentials_to_user_mapping('$federated_server_config') = '$expected_user_mapping'" \
should 't'
# Unit-test __cdb_add_default_options
# Unit-test __ft_add_default_options
read -d '' expected_default_options <<- EOF
{
"server": {
@ -725,7 +725,7 @@ EOF
}
}
EOF
sql postgres "SELECT cartodb.__cdb_add_default_options('$federated_server_config') = '$expected_default_options'" \
sql postgres "SELECT cartodb.__ft_add_default_options('$federated_server_config') = '$expected_default_options'" \
should 't'
# There must be a function with the expected interface

Loading…
Cancel
Save