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

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Bryn Llewellyn <bryn(at)yugabyte(dot)com>
Cc: 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 00:51:33
Message-ID: F8C21FF6-0E4B-4E27-B9C6-B1BE72B4E530@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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.

(And I have never liked the term "autocommit mode"; it really doesn't reveal much about what is going on.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan S. Katz 2023-02-19 02:20:31 Re: Support logical replication of DDLs
Previous Message Christophe Pettus 2023-02-19 00:43:00 Re: Who adds the "start transaction" and "commit" to the intended SQL statement in "autocommit" mode?