diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 7b3c63a..9706104 100644
*** a/src/backend/catalog/aclchk.c
--- b/src/backend/catalog/aclchk.c
***************
*** 45,53 ****
  #include "catalog/pg_ts_config.h"
  #include "catalog/pg_ts_dict.h"
  #include "commands/dbcommands.h"
  #include "commands/proclang.h"
  #include "commands/tablespace.h"
- #include "foreign/foreign.h"
  #include "miscadmin.h"
  #include "parser/parse_func.h"
  #include "utils/acl.h"
--- 45,53 ----
  #include "catalog/pg_ts_config.h"
  #include "catalog/pg_ts_dict.h"
  #include "commands/dbcommands.h"
+ #include "commands/defrem.h"
  #include "commands/proclang.h"
  #include "commands/tablespace.h"
  #include "miscadmin.h"
  #include "parser/parse_func.h"
  #include "utils/acl.h"
*************** objectNamesToOids(GrantObjectType objtyp
*** 683,689 ****
  			foreach(cell, objnames)
  			{
  				char	   *fdwname = strVal(lfirst(cell));
! 				Oid			fdwid = GetForeignDataWrapperOidByName(fdwname, false);
  
  				objects = lappend_oid(objects, fdwid);
  			}
--- 683,689 ----
  			foreach(cell, objnames)
  			{
  				char	   *fdwname = strVal(lfirst(cell));
! 				Oid			fdwid = get_foreign_data_wrapper_oid(fdwname, false);
  
  				objects = lappend_oid(objects, fdwid);
  			}
*************** objectNamesToOids(GrantObjectType objtyp
*** 692,698 ****
  			foreach(cell, objnames)
  			{
  				char	   *srvname = strVal(lfirst(cell));
! 				Oid			srvid = GetForeignServerOidByName(srvname, false);
  
  				objects = lappend_oid(objects, srvid);
  			}
--- 692,698 ----
  			foreach(cell, objnames)
  			{
  				char	   *srvname = strVal(lfirst(cell));
! 				Oid			srvid = get_foreign_server_oid(srvname, false);
  
  				objects = lappend_oid(objects, srvid);
  			}
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index c5cd51e..c73162e 100644
*** a/src/backend/commands/foreigncmds.c
--- b/src/backend/commands/foreigncmds.c
*************** RemoveForeignDataWrapper(DropFdwStmt *st
*** 686,692 ****
  	Oid			fdwId;
  	ObjectAddress object;
  
! 	fdwId = GetForeignDataWrapperOidByName(stmt->fdwname, true);
  
  	if (!superuser())
  		ereport(ERROR,
--- 686,692 ----
  	Oid			fdwId;
  	ObjectAddress object;
  
! 	fdwId = get_foreign_data_wrapper_oid(stmt->fdwname, true);
  
  	if (!superuser())
  		ereport(ERROR,
*************** RemoveForeignServer(DropForeignServerStm
*** 959,965 ****
  	Oid			srvId;
  	ObjectAddress object;
  
! 	srvId = GetForeignServerOidByName(stmt->servername, true);
  
  	if (!OidIsValid(srvId))
  	{
--- 959,965 ----
  	Oid			srvId;
  	ObjectAddress object;
  
! 	srvId = get_foreign_server_oid(stmt->servername, true);
  
  	if (!OidIsValid(srvId))
  	{
diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c
index 44cd181..be837d8 100644
*** a/src/backend/foreign/foreign.c
--- b/src/backend/foreign/foreign.c
***************
*** 19,24 ****
--- 19,25 ----
  #include "catalog/pg_foreign_table.h"
  #include "catalog/pg_type.h"
  #include "catalog/pg_user_mapping.h"
+ #include "commands/defrem.h"
  #include "foreign/fdwapi.h"
  #include "foreign/foreign.h"
  #include "funcapi.h"
*************** GetForeignDataWrapper(Oid fdwid)
*** 79,104 ****
  }
  
  
- /*
-  * GetForeignDataWrapperOidByName - look up the foreign-data wrapper
-  * OID by name.
-  */
- Oid
- GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok)
- {
- 	Oid			fdwId;
- 
- 	fdwId = GetSysCacheOid1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(fdwname));
- 
- 	if (!OidIsValid(fdwId) && !missing_ok)
- 		ereport(ERROR,
- 				(errcode(ERRCODE_UNDEFINED_OBJECT),
- 				 errmsg("foreign-data wrapper \"%s\" does not exist",
- 						fdwname)));
- 
- 	return fdwId;
- }
- 
  
  /*
   * GetForeignDataWrapperByName - look up the foreign-data wrapper
--- 80,85 ----
*************** GetForeignDataWrapperOidByName(const cha
*** 107,113 ****
  ForeignDataWrapper *
  GetForeignDataWrapperByName(const char *fdwname, bool missing_ok)
  {
! 	Oid			fdwId = GetForeignDataWrapperOidByName(fdwname, missing_ok);
  
  	if (!OidIsValid(fdwId))
  		return NULL;
--- 88,94 ----
  ForeignDataWrapper *
  GetForeignDataWrapperByName(const char *fdwname, bool missing_ok)
  {
! 	Oid			fdwId = get_foreign_data_wrapper_oid(fdwname, missing_ok);
  
  	if (!OidIsValid(fdwId))
  		return NULL;
*************** GetForeignServer(Oid serverid)
*** 172,202 ****
  
  
  /*
-  * GetForeignServerByName - look up the foreign server oid by name.
-  */
- Oid
- GetForeignServerOidByName(const char *srvname, bool missing_ok)
- {
- 	Oid			serverid;
- 
- 	serverid = GetSysCacheOid1(FOREIGNSERVERNAME, CStringGetDatum(srvname));
- 
- 	if (!OidIsValid(serverid) && !missing_ok)
- 		ereport(ERROR,
- 				(errcode(ERRCODE_UNDEFINED_OBJECT),
- 				 errmsg("server \"%s\" does not exist", srvname)));
- 
- 	return serverid;
- }
- 
- 
- /*
   * GetForeignServerByName - look up the foreign server definition by name.
   */
  ForeignServer *
  GetForeignServerByName(const char *srvname, bool missing_ok)
  {
! 	Oid			serverid = GetForeignServerOidByName(srvname, missing_ok);
  
  	if (!OidIsValid(serverid))
  		return NULL;
--- 153,164 ----
  
  
  /*
   * GetForeignServerByName - look up the foreign server definition by name.
   */
  ForeignServer *
  GetForeignServerByName(const char *srvname, bool missing_ok)
  {
! 	Oid			serverid = get_foreign_server_oid(srvname, missing_ok);
  
  	if (!OidIsValid(serverid))
  		return NULL;
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 691ba3b..4cec65c 100644
*** a/src/backend/utils/adt/acl.c
--- b/src/backend/utils/adt/acl.c
***************
*** 22,27 ****
--- 22,28 ----
  #include "catalog/pg_type.h"
  #include "catalog/pg_class.h"
  #include "commands/dbcommands.h"
+ #include "commands/defrem.h"
  #include "commands/proclang.h"
  #include "commands/tablespace.h"
  #include "foreign/foreign.h"
*************** convert_foreign_data_wrapper_name(text *
*** 3162,3168 ****
  {
  	char	   *fdwstr = text_to_cstring(fdwname);
  
! 	return GetForeignDataWrapperOidByName(fdwstr, false);
  }
  
  /*
--- 3163,3169 ----
  {
  	char	   *fdwstr = text_to_cstring(fdwname);
  
! 	return get_foreign_data_wrapper_oid(fdwstr, false);
  }
  
  /*
*************** convert_server_name(text *servername)
*** 3928,3934 ****
  {
  	char	   *serverstr = text_to_cstring(servername);
  
! 	return GetForeignServerOidByName(serverstr, false);
  }
  
  /*
--- 3929,3935 ----
  {
  	char	   *serverstr = text_to_cstring(servername);
  
! 	return get_foreign_server_oid(serverstr, false);
  }
  
  /*
diff --git a/src/include/foreign/foreign.h b/src/include/foreign/foreign.h
index d676f3f..b4bfa1b 100644
*** a/src/include/foreign/foreign.h
--- b/src/include/foreign/foreign.h
*************** typedef struct ForeignTable
*** 70,81 ****
  
  extern ForeignServer *GetForeignServer(Oid serverid);
  extern ForeignServer *GetForeignServerByName(const char *name, bool missing_ok);
- extern Oid	GetForeignServerOidByName(const char *name, bool missing_ok);
  extern UserMapping *GetUserMapping(Oid userid, Oid serverid);
  extern ForeignDataWrapper *GetForeignDataWrapper(Oid fdwid);
  extern ForeignDataWrapper *GetForeignDataWrapperByName(const char *name,
  							bool missing_ok);
- extern Oid	GetForeignDataWrapperOidByName(const char *name, bool missing_ok);
  extern ForeignTable *GetForeignTable(Oid relid);
  
  #endif   /* FOREIGN_H */
--- 70,79 ----
