After further thinking, I prefer the alternative approach of using
pq_sendcountedtext() as is and sticking the trailing zero byte on on the
receiving side. This is a more localized change, and keeps the logical
replication protocol consistent with the main FE/BE protocol. (Also, we
don't need to send a useless byte around.)
Patch attached, and also a test case.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services