47
47
#include "nodes/execnodes.h"
48
48
#include "nodes/pg_list.h"
49
49
#include "parser/parse_type.h"
50
+ #include "parser/scansup.h"
50
51
#include "tcop/tcopprot.h"
51
52
#include "utils/builtins.h"
52
53
#include "utils/fmgroids.h"
@@ -2107,13 +2108,13 @@ static remoteConn *
2107
2108
getConnectionByName (const char * name )
2108
2109
{
2109
2110
remoteConnHashEnt * hentry ;
2110
- char key [ NAMEDATALEN ] ;
2111
+ char * key ;
2111
2112
2112
2113
if (!remoteConnHash )
2113
2114
remoteConnHash = createConnHash ();
2114
2115
2115
- MemSet ( key , 0 , NAMEDATALEN );
2116
- snprintf (key , NAMEDATALEN - 1 , "%s" , name );
2116
+ key = pstrdup ( name );
2117
+ truncate_identifier (key , strlen ( key ), true );
2117
2118
hentry = (remoteConnHashEnt * ) hash_search (remoteConnHash ,
2118
2119
key , HASH_FIND , NULL );
2119
2120
@@ -2139,13 +2140,13 @@ createNewConnection(const char *name, remoteConn * rconn)
2139
2140
{
2140
2141
remoteConnHashEnt * hentry ;
2141
2142
bool found ;
2142
- char key [ NAMEDATALEN ] ;
2143
+ char * key ;
2143
2144
2144
2145
if (!remoteConnHash )
2145
2146
remoteConnHash = createConnHash ();
2146
2147
2147
- MemSet ( key , 0 , NAMEDATALEN );
2148
- snprintf (key , NAMEDATALEN - 1 , "%s" , name );
2148
+ key = pstrdup ( name );
2149
+ truncate_identifier (key , strlen ( key ), true );
2149
2150
hentry = (remoteConnHashEnt * ) hash_search (remoteConnHash , key ,
2150
2151
HASH_ENTER , & found );
2151
2152
@@ -2163,14 +2164,13 @@ deleteConnection(const char *name)
2163
2164
{
2164
2165
remoteConnHashEnt * hentry ;
2165
2166
bool found ;
2166
- char key [ NAMEDATALEN ] ;
2167
+ char * key ;
2167
2168
2168
2169
if (!remoteConnHash )
2169
2170
remoteConnHash = createConnHash ();
2170
2171
2171
- MemSet (key , 0 , NAMEDATALEN );
2172
- snprintf (key , NAMEDATALEN - 1 , "%s" , name );
2173
-
2172
+ key = pstrdup (name );
2173
+ truncate_identifier (key , strlen (key ), true);
2174
2174
hentry = (remoteConnHashEnt * ) hash_search (remoteConnHash ,
2175
2175
key , HASH_REMOVE , & found );
2176
2176
0 commit comments