From b7afd088963851c52111b1d7183d94af74d5b56d Mon Sep 17 00:00:00 2001 From: Euler Taveira Date: Wed, 1 Jul 2026 12:29:30 -0300 Subject: [PATCH] Escape relation name Use the standard escape_json() function to escape relation names in the JSON protocol. --- pglogical_proto_json.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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) {