Re: is ErrorResponse possible on Sync?

From: Andrei Matei <andreimatei1(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: is ErrorResponse possible on Sync?
Date: 2022-01-12 18:18:53
Message-ID: CABWLsevei_ZN45esJ7LSSvJ1A2X7vt2ygu9u5jSz4dpD8TaSFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-01-12 18:20:15 Re: generic plans and "initial" pruning
Previous Message Tom Lane 2022-01-12 18:05:04 Re: is ErrorResponse possible on Sync?