reported by Shinoda, Noriyoshi <noriyoshi.shinoda@hpe.com>; partial
patch by Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
#include "libpq-fe.h"
#include "pqexpbuffer.h"
#include "access/xlog.h"
+#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "replication/logicalproto.h"
}
keys[++i] = "fallback_application_name";
vals[i] = appname;
+ if (logical)
+ {
+ keys[++i] = "client_encoding";
+ vals[i] = GetDatabaseEncodingName();
+ }
keys[++i] = NULL;
vals[i] = NULL;
+ Assert(i < sizeof(keys));
+
conn = palloc0(sizeof(WalReceiverConn));
conn->streamConn = PQconnectdbParams(keys, vals, /* expand_dbname = */ true);
if (PQstatus(conn->streamConn) != CONNECTION_OK)
outputstr = OidOutputFunctionCall(typclass->typoutput, values[i]);
len = strlen(outputstr) + 1; /* null terminated */
pq_sendint(out, len, 4); /* length */
- appendBinaryStringInfo(out, outputstr, len); /* data */
+ pq_sendstring(out, outputstr); /* data */
pfree(outputstr);