Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1neCOo-0006ui-6s for pgsql-admin@arkaria.postgresql.org; Tue, 12 Apr 2022 09:01:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1neCOm-0000Ba-MH for pgsql-admin@arkaria.postgresql.org; Tue, 12 Apr 2022 09:01:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1neCOm-0000BQ-D6 for pgsql-admin@lists.postgresql.org; Tue, 12 Apr 2022 09:01:20 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1neCOj-00030p-QK for pgsql-admin@lists.postgresql.org; Tue, 12 Apr 2022 09:01:19 +0000 Received: from ANAT ([78.197.128.121]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.184]) with ESMTPSA (Nemesis) id 1MAwPf-1nosa049bl-00BKkG; Tue, 12 Apr 2022 11:01:14 +0200 From: "Michel SALAIS" To: "'Holger Jakobs'" , References: <548f2ed6-3209-705d-09e2-a5afbc6fb71c@quadratum-braccas.com> <6bfd5d91-bb06-1b56-f4f8-cc8f90307a35@jakobs.com> In-Reply-To: <6bfd5d91-bb06-1b56-f4f8-cc8f90307a35@jakobs.com> Subject: RE: set autocommit only for select statements Date: Tue, 12 Apr 2022 11:01:13 +0200 Message-ID: <005201d84e4b$dce0e6b0$96a2b410$@msym.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHTlB7akC9eUlVb4gTIfE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-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk -----Message d'origine----- De : Holger Jakobs =20 Envoy=C3=A9 : mardi 12 avril 2022 08:31 =C3=80 : pgsql-admin@lists.postgresql.org Objet : Re: set autocommit only for select statements Am 12.04.22 um 03:53 schrieb Mladen Gogala: > > The "autocommit" is a tool option which tells the tool whether to add=20 > "COMMIT" statement after each and every SQL. The RDBMS server only=20 > knows about transactions, as mandated by the ACID compliance. What the = > "autocommit" option of tools like psql actually does is to turn each=20 > of your SQL statements into a separate transaction. > 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, Holger -- Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012 -------------------------------------------------------------------------= ---------- Hi, It is a little more "complex" :-) A session can be put in AUTOCOMMIT mode or transaction mode. Tool "psql" = is by default in AUTOCOMMIT mode and can be put in transaction mode = using=20 \set AUTOCOMMIT off Pay attention to the variable case. It should be in capital letters. = When this is done, You don't need to start transactions explicitly and = the server behaves like Oracle but it is not an identical behavior. = Other points matter like the reaction to errors when in a transaction... = Other programming environments could choose another default operating = mode and however can offer to choose the operating mode at connection. Michel SALAIS