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 1kNhQm-0005aR-JM for pgsql-general@arkaria.postgresql.org; Wed, 30 Sep 2020 19:06:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNhQl-0005bI-J5 for pgsql-general@arkaria.postgresql.org; Wed, 30 Sep 2020 19:06:23 +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 1kNhQl-0005bB-Bq for pgsql-general@lists.postgresql.org; Wed, 30 Sep 2020 19:06:23 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNhQi-00058s-KI for pgsql-general@lists.postgresql.org; Wed, 30 Sep 2020 19:06:22 +0000 Received: from [80.187.82.56] (helo=[172.20.10.4]) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNhQc-0007yQ-Bg; Wed, 30 Sep 2020 21:06:14 +0200 From: Matthias Apitz To: Tom Lane Cc: Subject: Re: Problem close curser after rollback Date: Wed, 30 Sep 2020 21:06:13 +0200 User-Agent: Dekko/0.6.20; Qt/5.4.1; ubuntumirclient; Linux; MIME-Version: 1.0 Message-ID: In-Reply-To: <891496.1601491043@sss.pgh.pa.us> References: <20200930171312.GA14156@r314251-amd64> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 80.187.82.56 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wednesday, 30 September 2020 20:37:23 CEST, Tom Lane =20= wrote: > Matthias Apitz writes: >> El d=C3=ADa mi=C3=A9rcoles, septiembre 30, 2020 a las 05:26:39p. m.=20 >> +0200, Laurenz Albe escribi=C3=B3: >>> On Wed, 2020-09-30 at 13:32 +0000, Wiltsch,Sigrid wrote: >>>> What can I do so that the cursor is retained despite rollback? >=20 >>> You cannot start a transaction while you are reading a=20 >>> cursor; you probably >>> get a warning "there is already a transaction in progress". >=20 >> I think we will prepare the ten-liner in ESQL/C for further discussion. >=20 > I don't think you really need to: the point seems clear enough. >=20 > I don't especially like the idea you are suggesting though. The general > principle in SQL is that a rolled-back transaction should have no effect > after it's been rolled back. Allowing a cursor it creates to survive > the rollback would fly in the face of that principle. The general idea of transactions is that you START one at a moment, go ahead and a ROLLBACK rolls back everything what was done *after* the point of starting it. We have here the case of not beeing able to define the start of the transaction. The application wants to set it *after* the first (and=20 again after each next) fetch. You say, the transaction starts already with that fetch. We have to think how to deal with that missing feature in PostgreSQL ESQL/C to define the point of where the transaction starts.=20 Btw: In all of the other DBS (Informix, Sybase, Oracle) we could define=20 that point with START TRANSACTION. Thanks matthias --=20 Sent from my Ubuntu phone http://www.unixarea.de/ NO to the EU! NEIN zur EU!