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

From Andrei Matei
Subject Re: is ErrorResponse possible on Sync?
Date
Msg-id CABWLsevei_ZN45esJ7LSSvJ1A2X7vt2ygu9u5jSz4dpD8TaSFw@mail.gmail.com
Whole thread Raw
In response to Re: is ErrorResponse possible on Sync?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: is ErrorResponse possible on Sync?
Re: is ErrorResponse possible on Sync?
List pgsql-hackers
Thanks!

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.

                        regards, tom lane

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: is ErrorResponse possible on Sync?
Next
From: Robert Haas
Date:
Subject: Re: generic plans and "initial" pruning