Re: %d in log_line_prefix doesn't work for bg/autovacuum workers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: %d in log_line_prefix doesn't work for bg/autovacuum workers
Date
Msg-id 19222.1400266261@sss.pgh.pa.us
Whole thread Raw
In response to Re: %d in log_line_prefix doesn't work for bg/autovacuum workers  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: %d in log_line_prefix doesn't work for bg/autovacuum workers  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2014-05-16 14:02:44 -0400, Tom Lane wrote:
>> Not directly related to your gripe, but: where did this "padding" logic
>> come from, and what prevents it from creating invalidly-encoded output by
>> means of truncating multibyte characters in the middle?

> Isn't that syntax just the *minimal* width?

Ah, you're right, so sprintf shouldn't attempt to truncate the data
anywhere.  Nonetheless, this has created a hazard that wasn't there
before: with any padding spec, sprintf has to determine the
width-in-characters of the supplied string.  If glibc thinks the data
is invalid according to *its* idea of the prevailing encoding, it will
do something we won't like.  My recollection is it refuses to print
anything at all.
        regards, tom lane



pgsql-hackers by date:

Previous
From: David G Johnston
Date:
Subject: Re: chr() is still too loose about UTF8 code points
Next
From: Tom Lane
Date:
Subject: Re: chr() is still too loose about UTF8 code points