48
48
#include "nodes/execnodes.h"
49
49
#include "nodes/pg_list.h"
50
50
#include "parser/parse_type.h"
51
+ #include "parser/scansup.h"
51
52
#include "tcop/tcopprot.h"
52
53
#include "utils/builtins.h"
53
54
#include "utils/fmgroids.h"
@@ -2075,13 +2076,13 @@ static remoteConn *
2075
2076
getConnectionByName (const char * name )
2076
2077
{
2077
2078
remoteConnHashEnt * hentry ;
2078
- char key [ NAMEDATALEN ] ;
2079
+ char * key ;
2079
2080
2080
2081
if (!remoteConnHash )
2081
2082
remoteConnHash = createConnHash ();
2082
2083
2083
- MemSet ( key , 0 , NAMEDATALEN );
2084
- snprintf (key , NAMEDATALEN - 1 , "%s" , name );
2084
+ key = pstrdup ( name );
2085
+ truncate_identifier (key , strlen ( key ), true );
2085
2086
hentry = (remoteConnHashEnt * ) hash_search (remoteConnHash ,
2086
2087
key , HASH_FIND , NULL );
2087
2088
@@ -2107,13 +2108,13 @@ createNewConnection(const char *name, remoteConn * con)
2107
2108
{
2108
2109
remoteConnHashEnt * hentry ;
2109
2110
bool found ;
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 , key ,
2118
2119
HASH_ENTER , & found );
2119
2120
@@ -2136,14 +2137,13 @@ deleteConnection(const char *name)
2136
2137
{
2137
2138
remoteConnHashEnt * hentry ;
2138
2139
bool found ;
2139
- char key [ NAMEDATALEN ] ;
2140
+ char * key ;
2140
2141
2141
2142
if (!remoteConnHash )
2142
2143
remoteConnHash = createConnHash ();
2143
2144
2144
- MemSet (key , 0 , NAMEDATALEN );
2145
- snprintf (key , NAMEDATALEN - 1 , "%s" , name );
2146
-
2145
+ key = pstrdup (name );
2146
+ truncate_identifier (key , strlen (key ), true);
2147
2147
hentry = (remoteConnHashEnt * ) hash_search (remoteConnHash ,
2148
2148
key , HASH_REMOVE , & found );
2149
2149
0 commit comments