[PATCH] Fix escaping for '\' and '"' in pageinspect for gist

Roman Khapov <rkhapov@yandex-team.ru>

From: Roman Khapov <rkhapov@yandex-team.ru>
To: pgsql-hackers@lists.postgresql.org
Cc: michael@paquier.xyz
Date: 2025-12-29T15:47:58Z
Lists: pgsql-hackers

Attachments

Hi hackers!

I noticed, that there is bug in escaping values that contains '\' or '"' in text representation
inside pageinspect for gist: the string 'foo"bar' are printed like "foo""bar" and not "foo\"bar".

To fix that, we should do appendStringInfoCharMacro(&buf, '\\'); instead of
appendStringInfoCharMacro(&buf, ch); in case ch is one of that symbols.

Any thoughts?

--
Best regards,
Roman Khapov