Re: prepared statement "cu1" already exists (but it does not)

From: Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: prepared statement "cu1" already exists (but it does not)
Date: 2024-04-09 16:48:46
Message-ID: AM9P191MB1286990B716F5DED6BCDFF99B0072@AM9P191MB1286.EURP191.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Sent: Tuesday, April 9, 2024 6:36 PM
To: Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
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 <sebastien(dot)flaesch(at)4js(dot)com> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thiemo Kellner 2024-04-09 16:49:25 Re: [Code: 0, SQL State: 0A000] when "typing" from pg_catalog
Previous Message Thiemo Kellner 2024-04-09 16:48:44 Re: [Code: 0, SQL State: 0A000] when "typing" from pg_catalog