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 1jYvvo-0004CE-J2 for pgsql-general@arkaria.postgresql.org; Wed, 13 May 2020 18:16:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jYvvm-0003YW-No for pgsql-general@arkaria.postgresql.org; Wed, 13 May 2020 18:16:34 +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 1jYvvm-0003YP-Fi for pgsql-general@lists.postgresql.org; Wed, 13 May 2020 18:16:34 +0000 Received: from smh-06.1blu.de ([178.254.0.206]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jYvvf-0006Um-EX for pgsql-general@lists.postgresql.org; Wed, 13 May 2020 18:16:33 +0000 Received: from [172.16.29.5] (helo=sh4-5.1blu.de) by smh-06.1blu.de with esmtp (Exim 4.86_2) (envelope-from ) id 1jYvvZ-00006E-7V; Wed, 13 May 2020 20:16:21 +0200 Received: from ftp51246-2575596 by sh4-5.1blu.de with local (Exim 4.90_1) (envelope-from ) id 1jYvvZ-0004aQ-4n; Wed, 13 May 2020 20:16:21 +0200 Date: Wed, 13 May 2020 20:16:21 +0200 From: Matthias Apitz To: pgsql-general@lists.postgresql.org Subject: Re: ESQL/C: a ROLLBACK rolls back a COMMITED transaction Message-ID: <20200513181621.GA5181@sh4-5.1blu.de> Reply-To: Matthias Apitz References: <20200512145352.GA32335@sh4-5.1blu.de> <23100.1589298880@sss.pgh.pa.us> <20200512191429.GB32335@sh4-5.1blu.de> <9dbc6477-f9a2-b62a-e011-0983fe150741@aklaver.com> <20200512235207.GA3420@sh4-5.1blu.de> <20200513053405.GB26063@sh4-5.1blu.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk El día Mittwoch, Mai 13, 2020 a las 08:15:40 -0700, Adrian Klaver escribió: > In your original post you had: > > "We're facing in our ESQL/C written application a situation where a > commit'ed INSERT into a table is rolled back. I have here the ESQL/C > logging of the problem:" > ... > > "The INSERT of 1 row into table swd_daten was OK and commit'ed (marked line) > and a later rollback (last line) seems to roll it back, at least the row > isn't in the table. > > Any ideas? The connection is not set to AUTOCOMMIT." > > You then included a sequence of log messages that ended with a "rollback". > Within that sequence was the INSERT to swd_auftrag. It seemed reasonable to > ask whether that INSERT rolled back also. That is if the intent of this > thread is to figure out why the INSERT was rolled back. If the thread has > changed to fixing ESQL/C logging then ignore the above. The intention of my original post was to understand why the INSERT was rolled back. I do know this now: because I overlooked that the cancel of the transaction was done after the INSERT by CLOSE of a non open CURSOR. We're fixing this now already by checking in pg_cursors if the CURSOR is still open before issue the CLOSE. I don't know how expensive this is, but it seems that there is no other option to check this. The side step about fixing ESQL/C logging should be handled in another thread. Thanks all for your help matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub