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

2024-04-09 Thread Sebastien Flaesch
: Tom Lane Sent: Tuesday, April 9, 2024 6:36 PM To: Sebastien Flaesch Cc: pgsql-general 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 writes: >>>

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

2024-04-09 Thread Tom Lane
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 curso

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

2024-04-09 Thread Sebastien Flaesch
;cu1", "declare cu1 cursor for ... ", ... ) PQexecPrepared(pgConn, "cu1", ... ) ? So far this has always worked. Seb From: Tom Lane Sent: Monday, April 8, 2024 7:36 PM To: Sebastien Flaesch Cc: pgsql-general Subject: Re: prepared statement "cu1&quo

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

2024-04-08 Thread Sebastien Flaesch
Sent: Monday, April 8, 2024 7:36 PM To: Sebastien Flaesch Cc: pgsql-general 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 writes: > I understand that th

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

2024-04-08 Thread Tom Lane
Sebastien Flaesch writes: > I understand that the whole TX is aborted with PostgreSQL, and probably the > deallocate is useless since stmt was prepared inside the TX? As you can quickly discover with some manual experimentation, both PREPARE and DEALLOCATE are nontransactional, in the sense that

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

2024-04-08 Thread Dominique Devienne
On Mon, Apr 8, 2024 at 5:31 PM Sebastien Flaesch wrote: > I understand when this can happen, but in fact I do de-allocate prepared > statements when I should. > We've run into similar issues. We're in C++, and with RAII deallocate resources (Prepared Statements, Cursors) in Dtors. But as you saw

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

2024-04-08 Thread Sebastien Flaesch
Here a first PQtrace() file... assuming it can help. Seb From: Sebastien Flaesch Sent: Monday, April 8, 2024 5:31 PM To: pgsql-general Cc: Sebastien Flaesch Subject: prepared statement "cu1" already exists (but it does not) Hello, In a specific case,

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

2024-04-08 Thread Sebastien Flaesch
Hello, In a specific case, I get the error   prepared statement "cu1" already exists I understand when this can happen, but in fact I do de-allocate prepared statements when I should. I am investigating on this for several hours now, I thought I could share my problem to see if this ring a be