pg_clean_ascii(): escape bytes rather than lose them

Peter Eisentraut <peter@eisentraut.org>

Commit: 45b1a67a0fcb3f1588df596431871de4c93cb76f
Author: Peter Eisentraut <peter@eisentraut.org>
Date: 2022-09-13T14:10:44Z
Releases: 16.0
pg_clean_ascii(): escape bytes rather than lose them

Rather than replace each unprintable byte with a '?' character, replace
it with a hex escape instead. The API now allocates a copy rather than
modifying the input in place.

Author: Jacob Champion <jchampion@timescale.com>
Discussion: https://www.postgresql.org/message-id/CAAWbhmgsvHrH9wLU2kYc3pOi1KSenHSLAHBbCVmmddW6-mc_=w@mail.gmail.com

Files

PathChange+/−
src/backend/postmaster/postmaster.c modified +1 −5
src/backend/utils/misc/guc.c modified +20 −2
src/common/string.c modified +43 −9
src/include/common/string.h modified +1 −1

Discussion