I've been looking at ways to reorganize and/or clean up pg_dump.c.
One thing I have noticed is the usage of PQExpBuffer in situations where the query has no optional parts and no string interpolation.
Attached is a patch to replace those usages with the string literal itself. There are still a few cases where a buffer is used for a trivial query and then reset and reused for a more complicated query generation. In those cases, I did not make the change so as to keep this patch simple.