On 19th of November 2019, Thomas Munro committed patch:
Allow invisible PROMPT2 in psql. Keep track of the visible width of PROMPT1, and provide %w as a way for PROMPT2 to generate the same number of spaces. Author: Thomas Munro, with ideas from others Discussion: https://postgr.es/m/CA%2BhUKG%2BzGd7RigjWbxwhzGW59gUpf76ydQECeGdEdodH6nd__A%40mail.gmail.com
Continue reading Waiting for PostgreSQL 13 – Allow invisible PROMPT2 in psql.