Re: Prepared statement already exists - Mailing list pgsql-general

From Daniel Verite
Subject Re: Prepared statement already exists
Date
Msg-id 0a84023b-d648-497d-bd9b-c743d50af9ae@mm
Whole thread Raw
In response to Re: Prepared statement already exists  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Responses Re: Prepared statement already exists
List pgsql-general
    Albe Laurenz wrote:

> You'll have to find a way to pick or generate unique names for the
> prepared statements.
> You could check for name collisions and disambiguate with a suffix
> or something.

By the way, why do the prepared statements require to be named at all?
With other DBMS such as oracle or mysql, one can prepare statements
without providing any name for them: the prepare() step returns a
"statement handle" that is to be passed to subsequent exec() calls, no
unique name is involved. I know that you can pass an empty string to
PQPrepare(), but only one such statement can be used at a time, so it's
not the same thing.

Currently with pg, using prepared statements more or less implies
implementing an application-wide policy about naming them, otherwise
there is always the risk that some code upper in the stack has a live
statement with the same name. And what about contributed code or
libraries? That would be easier if this global namespace for prepared
statements didn't exist in the first place.

 Best regards,
--
 Daniel
 PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Propose: enum with all registered table names?
Next
From: Tom Lane
Date:
Subject: Re: Propose: enum with all registered table names?