From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Dave Cramer <davecramer(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: v11 transaction semantics inside procedures |
Date: | 2018-09-20 16:10:53 |
Message-ID: | CAFj8pRAJacSkFD=5a5i0hy-2G3F5cmmm0Fd7mdYiFYoVN4bV-g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
čt 20. 9. 2018 v 17:55 odesílatel Dave Cramer <davecramer(at)gmail(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?= | 2018-09-20 17:07:10 | Re: generating bootstrap entries for array types |
Previous Message | Tom Lane | 2018-09-20 16:10:52 | Re: generating bootstrap entries for array types |