Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elGVa-0000jJ-Pj for pgsql-jdbc@arkaria.postgresql.org; Mon, 12 Feb 2018 15:59:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elGVZ-00048k-8v for pgsql-jdbc@arkaria.postgresql.org; Mon, 12 Feb 2018 15:59:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1elGVZ-00048a-2x for pgsql-jdbc@lists.postgresql.org; Mon, 12 Feb 2018 15:59:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elGVS-0001t4-29 for pgsql-jdbc@postgresql.org; Mon, 12 Feb 2018 15:59:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w1CFwvEW003559; Mon, 12 Feb 2018 10:58:57 -0500 From: Tom Lane To: Vladimir Sitnikov cc: Jaime Soler , Dave Cramer , Brad DeJong , List Subject: Re: ResultSet storing all rows with defaulftFetchSize to 5000 In-reply-to: References: Comments: In-reply-to Vladimir Sitnikov message dated "Mon, 12 Feb 2018 15:45:05 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3557.1518451137.1@sss.pgh.pa.us> Date: Mon, 12 Feb 2018 10:58:57 -0500 Message-ID: <3558.1518451137@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Vladimir Sitnikov writes: > I have no idea why PostgreSQL closes all the cursors as transaction > ends, Because the SQL standard says so. If a cursor isn't declared WITH HOLD, then it's implicitly closed at transaction commit, cf SQL:2011 4.33 "Cursors": An open cursor that was not defined as a holdable cursor is also closed by a . Also, 14.2 says that WITHOUT HOLD is the default assumption if you don't explicitly say WITH HOLD. (Yes, we do support WITH HOLD.) regards, tom lane