Re: v11 transaction semantics inside procedures

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: v11 transaction semantics inside procedures
Дата
Msg-id CAFj8pRAJacSkFD=5a5i0hy-2G3F5cmmm0Fd7mdYiFYoVN4bV-g@mail.gmail.com
обсуждение исходный текст
Ответ на v11 transaction semantics inside procedures  (Dave Cramer <davecramer@gmail.com>)
Список pgsql-hackers
Hi

čt 20. 9. 2018 v 17:55 odesílatel Dave Cramer <davecramer@gmail.com> napsal:
Is there somewhere that the transaction semantics inside a procedure are documented ? From what I can tell transactions start from the first DML statement and end implicitly when the procedure exits. Commit or Rollback can be called anytime inside the transaction and this implicitly starts another transaction.

Is there anything else I am missing ? Does DDL get applied after the transaction ends ?

The CALL statement starts possible chain of transactions. You can check pg_stat_activity - transaction is started by CALL command.
 

I do find this somewhat surprising as Postgres typically requires a BEGIN statement to start a transaction block.

When SELECT is not executed under explicitly started transactions, then transaction is started implicitly before execution of SELECT command.

There is different behave - SELECT is executed under only one transaction without exception. The procedure looks like client batch executed on server. It can be sequence of transactions.

Regards

Pavel


Thanks
Dave Cramer

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: generating bootstrap entries for array types
Следующее
От: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Дата:
Сообщение: Re: generating bootstrap entries for array types