I work on CockroachDB - which is wire-compatible with Postgres - so I'm interested in what the server can and cannot do.
Uh ... I don't think Sync itself can fail. Any ErrorResponse you see there is really from failure of some prior command.
Hmm, this got me curious. If Sync itself cannot fail, then what is this sentence really saying: "This parameterless message (ed. Sync) causes the backend to close the current transaction if it's not inside a BEGIN/COMMIT transaction block (“close” meaning to commit if no error, or roll back if error)." ? This seems to say that, outside of BEGIN/END, the transaction is committed at Sync time (i.e. if the Sync is never sent, nothing is committed). Presumably, committing a transaction can fail even if no previous command/statement failed, right?
The Sync is really delimiting how much stuff you'd like to skip in case of a failure. Basically this is to allow pipelining of commands, with the ability to discard later commands if an earlier one fails.
But in any case, no, Sync would not suppress an error message if one is needed.