diff --git a/pglogical_proto_json.c b/pglogical_proto_json.c index 4952417..6952f1f 100644 --- a/pglogical_proto_json.c +++ b/pglogical_proto_json.c @@ -118,10 +118,11 @@ pglogical_json_write_change(StringInfo out, const char *change, Relation rel, Bitmapset *att_list) { appendStringInfoChar(out, '{'); - appendStringInfo(out, "\"action\":\"%s\",\"relation\":[\"%s\",\"%s\"]", - change, - get_namespace_name(RelationGetNamespace(rel)), - RelationGetRelationName(rel)); + appendStringInfo(out, "\"action\":\"%s\",\"relation\":[", change); + escape_json(out, get_namespace_name(RelationGetNamespace(rel))); + appendStringInfoChar(out, ','); + escape_json(out, RelationGetRelationName(rel)); + appendStringInfoChar(out, ']'); if (oldtuple) {