Re: is ErrorResponse possible on Sync?

Поиск
Список
Период
Сортировка
От Tatsuo Ishii
Тема Re: is ErrorResponse possible on Sync?
Дата
Msg-id 20220113.085101.1181960333873795961.t-ishii@sranhm.sra.co.jp
обсуждение исходный текст
Ответ на Re: is ErrorResponse possible on Sync?  (Andrei Matei <andreimatei1@gmail.com>)
Список pgsql-hackers
> 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).

Yes, if you do not send Sync and terminate the session, then the
transaction will not be committed.

FE=> Parse(stmt="", query="INSERT INTO t1 VALUES(2)")
FE=> Bind(stmt="", portal="")
FE=> Execute(portal="")
FE=> Terminate

After this, I don't see the row (2) in table t1.

> Presumably, committing a transaction can fail even if no
> previous command/statement failed, right?

Right. Alvaro gave an excellent example.

Best reagards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: parse/analyze API refactoring
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Windows vs recovery tests