From: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
---|---|
To: | Mladen Gogala <gogala(dot)mladen(at)gmail(dot)com> |
Cc: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: set autocommit only for select statements |
Date: | 2022-04-12 14:20:28 |
Message-ID: | YlWKrC7dsyj1cZee@jrouhaud |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2022-04-12 16:18:09 | regarding PG on ZFS performance |
Previous Message | Simon Riggs | 2022-04-12 12:49:39 | Re: set autocommit only for select statements |