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 1lVeDr-0004fK-OP for pgsql-general@arkaria.postgresql.org; Sun, 11 Apr 2021 17:50:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lVeDp-0007K9-6v for pgsql-general@arkaria.postgresql.org; Sun, 11 Apr 2021 17:50:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lVeDo-0007J9-Vd for pgsql-general@lists.postgresql.org; Sun, 11 Apr 2021 17:50:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lVeDl-0004Zf-GD for pgsql-general@postgresql.org; Sun, 11 Apr 2021 17:50:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 13BHo1ED2691495; Sun, 11 Apr 2021 13:50:01 -0400 From: Tom Lane To: "Abraham, Danny" cc: "pgsql-general@postgresql.org" Subject: Re: Reuse of REF Cursor In-reply-to: References: <2671626.1618154631@sss.pgh.pa.us> Comments: In-reply-to "Abraham, Danny" message dated "Sun, 11 Apr 2021 15:45:06 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2691493.1618163401.1@sss.pgh.pa.us> Date: Sun, 11 Apr 2021 13:50:01 -0400 Message-ID: <2691494.1618163401@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Abraham, Danny" writes: > stmt := 'select count(*) from ' || table_name; > open C1 for execute stmt; > fetch C1 into rc; > close C1; > ... That still isn't a self-contained example; perhaps more usefully, you've not told us exactly what error you're seeing, either. FWIW, I tried executing a fragment like the above in a loop, and it seemed fine. regards, tom lane