WIP: Add CDB_Federated_Server_Unregister

This commit is contained in:
Raul Marin
2019-10-28 18:34:46 +01:00
parent eb02ca4d86
commit acf1f2dbd4
4 changed files with 137 additions and 22 deletions

View File

@@ -184,15 +184,17 @@ RETURNS void AS $$
DECLARE
row record;
option record;
fdw_objects_name NAME := @extschema@.__CDB_User_FDW_Object_Names(fdw_input_name);
fdw_objects_name NAME := fdw_input_name;
BEGIN
-- TODO: refactor with original function
-- This function tries to be as idempotent as possible, by not creating anything more than once
-- (not even using IF NOT EXIST to avoid throwing warnings)
IF NOT EXISTS ( SELECT * FROM pg_extension WHERE extname = 'postgres_fdw') THEN
CREATE EXTENSION postgres_fdw;
RAISE NOTICE 'Created postgres_fdw EXTENSION';
RAISE EXCEPTION 'postgres_fdw extension is not installed'
USING HINT = 'Please install it with "CREATE EXTENSION postgres_fdw"';
END IF;
-- Create FDW first if it does not exist
IF NOT EXISTS ( SELECT * FROM pg_foreign_server WHERE srvname = fdw_objects_name)
THEN