is ErrorResponse possible on Sync? - Mailing list pgsql-hackers

From Andrei Matei
Subject is ErrorResponse possible on Sync?
Date
Msg-id CABWLseub08wdSS0V63uK9gazbKLUysXcGizLcBk6+UUz9DpOhw@mail.gmail.com
Whole thread Raw
Responses Re: is ErrorResponse possible on Sync?
Re: is ErrorResponse possible on Sync?
List pgsql-hackers
Hello Postgres friends,

I've got a question about the wire protocol; the relevant text in the docs seems a bit ambiguous to me. If the processing of a Sync message fails (e.g. because the commit of the current transaction fails), is the backend allowed to respond with an ErrorResponse, in addition to the ReadyForQuery message? Or, does the backend swallow the error, and return only the ReadyForQuery (I hope not).

The docs say:
"""
At completion of each series of extended-query messages, the frontend should issue a Sync message. This parameterless message 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). Then a ReadyForQuery response is issued. The purpose of Sync is to provide a resynchronization point for error recovery. When an error is detected while processing any extended-query message, the backend issues ErrorResponse, then reads and discards messages until a Sync is reached, then issues ReadyForQuery and returns to normal message processing. (But note that no skipping occurs if an error is detected while processing Sync — this ensures that there is one and only one ReadyForQuery sent for each Sync.)
"""

This paragraph acknowledges that an error can be "detected" while processing a Sync, but one reading of it might suggest that the only response from a Sync is a single ReadyForQueryMessage.

Thanks!

- Andrei

pgsql-hackers by date:

Previous
From: "Bossart, Nathan"
Date:
Subject: Re: do only critical work during single-user vacuum?
Next
From: Vladimir Sitnikov
Date:
Subject: Re: is ErrorResponse possible on Sync?