diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c
index 7ad8e8e..12d93f3 100644
--- a/src/backend/foreign/foreign.c
+++ b/src/backend/foreign/foreign.c
@@ -25,6 +25,7 @@
 #include "optimizer/paths.h"
 #include "tcop/tcopprot.h"
 #include "utils/builtins.h"
+#include "utils/injection_point.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
 #include "utils/syscache.h"
@@ -189,6 +190,8 @@ GetForeignServerByName(const char *srvname, bool missing_ok)
 	if (!OidIsValid(serverid))
 		return NULL;
 
+	INJECTION_POINT("foreign-server-before-server-fetch", NULL);
+
 	return GetForeignServer(serverid);
 }
 
diff --git a/src/test/modules/injection_points/Makefile b/src/test/modules/injection_points/Makefile
index a7a16d5..78a04cc 100644
--- a/src/test/modules/injection_points/Makefile
+++ b/src/test/modules/injection_points/Makefile
@@ -33,6 +33,7 @@ ISOLATION = basic \
 	    repack_toast \
 	    ri_fastpath_reindex \
 	    ri_fastpath_snapshot \
+	    create_user_mapping_server_drop \
 	    syscache-update-pruned \
 	    $(WAIT_CLEANUP_TST) \
 	    heap_lock_update \
diff --git a/src/test/modules/injection_points/expected/create_user_mapping_server_drop.out b/src/test/modules/injection_points/expected/create_user_mapping_server_drop.out
new file mode 100644
index 0000000..da08634
--- /dev/null
+++ b/src/test/modules/injection_points/expected/create_user_mapping_server_drop.out
@@ -0,0 +1,27 @@
+Parsed test spec with 2 sessions
+
+starting permutation: create_mapping drop_server wakeup s1_noop
+step create_mapping: SELECT mapping_race_sqlstate(); <waiting ...>
+step drop_server: DROP SERVER mapping_server CASCADE;
+step wakeup: 
+	RESET ROLE;
+	SELECT injection_points_detach('foreign-server-before-server-fetch');
+	SELECT injection_points_wakeup('foreign-server-before-server-fetch');
+
+injection_points_detach
+-----------------------
+                       
+(1 row)
+
+injection_points_wakeup
+-----------------------
+                       
+(1 row)
+
+step create_mapping: <... completed>
+mapping_race_sqlstate
+---------------------
+42704                
+(1 row)
+
+step s1_noop: 
diff --git a/src/test/modules/injection_points/specs/create_user_mapping_server_drop.spec b/src/test/modules/injection_points/specs/create_user_mapping_server_drop.spec
new file mode 100644
index 0000000..80b1867
--- /dev/null
+++ b/src/test/modules/injection_points/specs/create_user_mapping_server_drop.spec
@@ -0,0 +1,53 @@
+# A concurrent DROP SERVER between name-to-OID lookup and fetching the server
+# by OID must not turn CREATE USER MAPPING into an internal cache lookup error.
+
+setup
+{
+	CREATE EXTENSION injection_points;
+	CREATE ROLE mapping_owner;
+	CREATE FOREIGN DATA WRAPPER mapping_fdw;
+	GRANT USAGE ON FOREIGN DATA WRAPPER mapping_fdw TO mapping_owner;
+	SET ROLE mapping_owner;
+	CREATE SERVER mapping_server FOREIGN DATA WRAPPER mapping_fdw;
+	RESET ROLE;
+	CREATE FUNCTION mapping_race_sqlstate() RETURNS text
+	LANGUAGE plpgsql AS $$
+	BEGIN
+		EXECUTE 'CREATE USER MAPPING FOR PUBLIC SERVER mapping_server';
+		RETURN 'success';
+	EXCEPTION WHEN OTHERS THEN
+		RETURN SQLSTATE;
+	END;
+	$$;
+}
+
+teardown
+{
+	DROP SERVER IF EXISTS mapping_server CASCADE;
+	DROP FUNCTION mapping_race_sqlstate();
+	DROP FOREIGN DATA WRAPPER mapping_fdw;
+	DROP ROLE mapping_owner;
+	DROP EXTENSION injection_points;
+}
+
+session s1
+setup
+{
+	SELECT injection_points_set_local();
+	SELECT injection_points_attach('foreign-server-before-server-fetch', 'wait');
+	SET ROLE mapping_owner;
+}
+step create_mapping { SELECT mapping_race_sqlstate(); }
+step s1_noop { }
+
+session s2
+setup { SET ROLE mapping_owner; }
+step drop_server { DROP SERVER mapping_server CASCADE; }
+step wakeup
+{
+	RESET ROLE;
+	SELECT injection_points_detach('foreign-server-before-server-fetch');
+	SELECT injection_points_wakeup('foreign-server-before-server-fetch');
+}
+
+permutation create_mapping drop_server wakeup s1_noop
