public inbox for [email protected]  
help / color / mirror / Atom feed
From: Sebastien Flaesch <[email protected]>
To: Tom Lane <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: prepared statement "cu1" already exists (but it does not)
Date: Tue, 9 Apr 2024 16:48:46 +0000
Message-ID: <AM9P191MB1286990B716F5DED6BCDFF99B0072@AM9P191MB1286.EURP191.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <[email protected]>
References: <AM9P191MB1286DAAE95E27A8FB79376D5B0002@AM9P191MB1286.EURP191.PROD.OUTLOOK.COM>
	<AM9P191MB1286601145DE06E7B0D3DA57B0002@AM9P191MB1286.EURP191.PROD.OUTLOOK.COM>
	<[email protected]>
	<AM9P191MB1286CCAAF4328B0F5F72109AB0072@AM9P191MB1286.EURP191.PROD.OUTLOOK.COM>
	<[email protected]>

Ok thanks Tom,

My understanding from your last comment:

Since prepared statements and server cursors use different name spaces, it's save to use the same name as in

PQprepare(pgConn, "cu1", "declare cu1 cursor for ... ", ... )

Seb
________________________________
From: Tom Lane <[email protected]>
Sent: Tuesday, April 9, 2024 6:36 PM
To: Sebastien Flaesch <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: prepared statement "cu1" already exists (but it does not)

EXTERNAL: Do not click links or open attachments if you do not recognize the sender.

Sebastien Flaesch <[email protected]> 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




view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: prepared statement "cu1" already exists (but it does not)
  In-Reply-To: <AM9P191MB1286990B716F5DED6BCDFF99B0072@AM9P191MB1286.EURP191.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox