In connection with the discussion at [1], I realized that we could unwind the hacks we've introduced --- mostly in commit 54cd4f045 --- to avoid depending on the behavior of %.*s format in printf. Now that we always use our own snprintf.c code, we know that it measures field widths in bytes not characters, and we also know that use of this format won't cause random encoding-related failures.
Some of the changes are not worth undoing; for example using strlcpy instead of snprintf to truncate a string is a net win by any measure. But places where we introduced a temporary buffer, such as the change in truncate_identifier() in 54cd4f045, would be better off with the old coding. In any case we could remove all the comments warning against using this feature. Thoughts? regards, tom lane [1] https://www.postgresql.org/message-id/flat/a120087c-4c88-d9d4-1ec5-808d7a7f133d%40gmail.com