diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index fd7c8e6..deaddfb 100644 *** a/contrib/dblink/dblink.c --- b/contrib/dblink/dblink.c *************** *** 54,59 **** --- 54,60 ---- #include "nodes/nodes.h" #include "nodes/pg_list.h" #include "parser/parse_type.h" + #include "parser/scansup.h" #include "utils/acl.h" #include "utils/array.h" #include "utils/builtins.h" *************** static remoteConn * *** 2193,2205 **** getConnectionByName(const char *name) { remoteConnHashEnt *hentry; ! char key[NAMEDATALEN]; if (!remoteConnHash) remoteConnHash = createConnHash(); ! MemSet(key, 0, NAMEDATALEN); ! snprintf(key, NAMEDATALEN - 1, "%s", name); hentry = (remoteConnHashEnt *) hash_search(remoteConnHash, key, HASH_FIND, NULL); --- 2194,2206 ---- getConnectionByName(const char *name) { remoteConnHashEnt *hentry; ! char *key; if (!remoteConnHash) remoteConnHash = createConnHash(); ! key = pstrdup(name); ! truncate_identifier(key, strlen(key), true); hentry = (remoteConnHashEnt *) hash_search(remoteConnHash, key, HASH_FIND, NULL); *************** createNewConnection(const char *name, re *** 2225,2237 **** { remoteConnHashEnt *hentry; bool found; ! char key[NAMEDATALEN]; if (!remoteConnHash) remoteConnHash = createConnHash(); ! MemSet(key, 0, NAMEDATALEN); ! snprintf(key, NAMEDATALEN - 1, "%s", name); hentry = (remoteConnHashEnt *) hash_search(remoteConnHash, key, HASH_ENTER, &found); --- 2226,2238 ---- { remoteConnHashEnt *hentry; bool found; ! char *key; if (!remoteConnHash) remoteConnHash = createConnHash(); ! key = pstrdup(name); ! truncate_identifier(key, strlen(key), true); hentry = (remoteConnHashEnt *) hash_search(remoteConnHash, key, HASH_ENTER, &found); *************** deleteConnection(const char *name) *** 2249,2262 **** { remoteConnHashEnt *hentry; bool found; ! char key[NAMEDATALEN]; if (!remoteConnHash) remoteConnHash = createConnHash(); ! MemSet(key, 0, NAMEDATALEN); ! snprintf(key, NAMEDATALEN - 1, "%s", name); ! hentry = (remoteConnHashEnt *) hash_search(remoteConnHash, key, HASH_REMOVE, &found); --- 2250,2262 ---- { remoteConnHashEnt *hentry; bool found; ! char *key; if (!remoteConnHash) remoteConnHash = createConnHash(); ! key = pstrdup(name); ! truncate_identifier(key, strlen(key), true); hentry = (remoteConnHashEnt *) hash_search(remoteConnHash, key, HASH_REMOVE, &found); *************** get_connect_string(const char *servernam *** 2390,2399 **** StringInfo buf = makeStringInfo(); ForeignDataWrapper *fdw; AclResult aclresult; /* first gather the server connstr options */ ! if (strlen(servername) < NAMEDATALEN) ! foreign_server = GetForeignServerByName(servername, true); if (foreign_server) { --- 2390,2401 ---- StringInfo buf = makeStringInfo(); ForeignDataWrapper *fdw; AclResult aclresult; + char *srvname; /* first gather the server connstr options */ ! srvname = pstrdup(servername); ! truncate_identifier(srvname, strlen(srvname), true); ! foreign_server = GetForeignServerByName(srvname, true); if (foreign_server) {