Re: Prepared statement already exists

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Prepared statement already exists
Date: 2008-11-20 17:19:45
Message-ID: 0a84023b-d648-497d-bd9b-c743d50af9ae@mm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-11-20 17:22:40 Re: Propose: enum with all registered table names?
Previous Message Alvaro Herrera 2008-11-20 17:17:39 Re: Propose: enum with all registered table names?