From: Julien Rouhaud <rjuju123@gmail.com>
To: Mladen Gogala <gogala.mladen@gmail.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: set autocommit only for select statements
Date: Tue, 12 Apr 2022 22:20:28 +0800
Message-ID: <YlWKrC7dsyj1cZee@jrouhaud> (raw)
In-Reply-To: <37b5b251-83f8-56bc-579d-882daaa4fc47@gmail.com>
References: <548f2ed6-3209-705d-09e2-a5afbc6fb71c@quadratum-braccas.com>
<bc177652-b317-0f78-cc82-466f24315549@gmail.com>
<6bfd5d91-bb06-1b56-f4f8-cc8f90307a35@jakobs.com>
<37b5b251-83f8-56bc-579d-882daaa4fc47@gmail.com>
On Tue, Apr 12, 2022 at 08:00:35AM -0400, Mladen Gogala wrote:
> On 4/12/22 02:31, Holger Jakobs wrote:
> > What you write about psql sending a COMMIT statement after each
> > statement is wrong. It may be true for other database systems.
> >
> > PostgreSQL as a server commits each statement automatically unless the
> > client has started a transaction with BEGIN or START TRANSACTION
> > statements.
> >
> > This can be proved easily by not using psql as a client, but some
> > programming language.
> >
> > Regards,
>
> If what you are saying was true, then autocommit would be a database mode,
> not a tool mode. It isn't a database mode. Q.E.D.
That's actually mostly true. Postgres will start an implicit transaction for
every query (or multiple queries) outside a transaction and will implicitly
commit it after a successful execution. The only difference is there you won't
see a BEGIN / COMMIT anywhere, but the same underlying code will be executed.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: rjuju123@gmail.com, gogala.mladen@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: set autocommit only for select statements
In-Reply-To: <YlWKrC7dsyj1cZee@jrouhaud>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox