Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: Bryn Llewellyn <bryn(at)yugabyte(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?
Date: 2023-02-19 02:52:37
Message-ID: CAB8KJ=gVega6nUg-HutiinEyR2LU-5qm6PQKBOmkn0ozD6MroA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2023年2月19日(日) 9:51 Christophe Pettus <xof(at)thebuild(dot)com>:
>
>
>
> > On Feb 18, 2023, at 15:49, Bryn Llewellyn <bryn(at)yugabyte(dot)com> wrote:
> >
> > I’ve searched in vain for an account of how "autocommit" mode actually works.
>
> I realize now I may have misinterpreted your question... apologies if so! If you mean the BEGIN and COMMIT statement that some client libraries insert into the stream when autocommit is off, that's the client, not PostgreSQL.
>
> PostgreSQL has no idea that mode even exists: it either sees statements without transactions, which run in their own transaction, or BEGIN / COMMIT statements. Because client stacks have traditionally loved to provide their own transaction semantics, they might inject BEGIN and COMMIT statements, but that's not something PostgreSQL sees.

Historical trivia: PostgreSQL had a (backend) "autocommit" GUC in 7.3
only, which remained as
a dummy GUC until 9.5 (see: https://pgpedia.info/a/autocommit.html ).

Regards

Ian Barwick

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2023-02-19 02:54:35 Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?
Previous Message David G. Johnston 2023-02-19 02:50:47 Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?