Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruEW1-003jZy-9J for pgsql-general@arkaria.postgresql.org; Tue, 09 Apr 2024 16:40:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ruEW0-007ixA-1X for pgsql-general@arkaria.postgresql.org; Tue, 09 Apr 2024 16:40:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruESt-007dfL-6B for pgsql-general@lists.postgresql.org; Tue, 09 Apr 2024 16:36:55 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruESr-0022T4-3g for pgsql-general@lists.postgresql.org; Tue, 09 Apr 2024 16:36:54 +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 439Gao7D3751334; Tue, 9 Apr 2024 12:36:51 -0400 From: Tom Lane To: Sebastien Flaesch cc: pgsql-general Subject: Re: prepared statement "cu1" already exists (but it does not) In-reply-to: References: <3298762.1712597811@sss.pgh.pa.us> Comments: In-reply-to Sebastien Flaesch message dated "Tue, 09 Apr 2024 14:44:18 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3751332.1712680610.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 09 Apr 2024 12:36:50 -0400 Message-ID: <3751333.1712680610@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Sebastien Flaesch writes: >>> Is it an issue if I use the same name for a prepared statement and the= server cursor? I mean: >> From memory, I think those share the same "portal" namespace. > Can you please elaborate? > Is it supported to do: > PQprepare(pgConn, "cu1", "declare cu1 cursor for ... ", ... ) > PQexecPrepared(pgConn, "cu1", ... ) > ? > So far this has always worked. Ah, sorry, what I should have said is that the SQL PREPARE command works with the same namespace as PQprepare (which is a thin wrapper over the wire-protocol Parse command). There is a different namespace for cursors. Cursors do share that namespace with the wire-protocol "portal" concept, but libpq doesn't directly expose portals. regards, tom lane