 BEGIN
     RETURN QUERY SELECT 
         -- Name as shown to the user
-        @extschema@.__CDB_FS_Extract_Public_Name(s.srvname) AS "Name",
+        @extschema@.__CDB_FS_Extract_Server_Name(s.srvname) AS "Name",
 
         -- Which driver are we using (postgres_fdw, odbc_fdw...)
         f.fdwname::text AS "Driver",

        END IF;
        RETURN object_name::name;
    ELSE
        RAISE EXCEPTION 'Object name is too long to be used as identifier';
    END IF;
END
$$
LANGUAGE PLPGSQL IMMUTABLE PARALLEL SAFE;

CREATE OR REPLACE FUNCTION @extschema@.__CDB_FS_Extract_Public_Name(fdw_stored_name NAME)
RETURNS TEXT
AS $$
    SELECT right(fdw_stored_name,
            char_length(fdw_stored_name::TEXT) -  char_length(@extschema@.__CDB_FS_Name_Pattern()))::TEXT;
$$
LANGUAGE SQL IMMUTABLE PARALLEL SAFE;


-- List registered servers

RETURNS void
AS $$
DECLARE
    final_name text := @extschema@.__CDB_FS_Generate_Server_Name(input_name := server, check_existence := true);
BEGIN
    EXECUTE @extschema@._CDB_Drop_User_PG_FDW_Server(fdw_input_name := final_name, force := true);
END
