Andres Freund <andres(at)anarazel(dot)de> writes:
> We already have pg_clean_ascii() and use it for application_name, fwiw.
Yeah, we should just use that. If anyone wants to upgrade the situation
for non-ASCII data later, fixing it for all of these cases at once would
be appropriate.
regards, tom lane