Re: PREPARE and transactions - Mailing list pgsql-hackers

From Richard Huxton
Subject Re: PREPARE and transactions
Date
Msg-id 40DA8129.2090601@archonet.com
Whole thread Raw
In response to Re: PREPARE and transactions  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-hackers
Greg Sabino Mullane wrote:
>>* PREPARE OR REPLACE...
>>
>>This would be an incredibly useful command since there's no
>>way of _checking_ in advance that a name is already used as a
>>prepared statement...
> 
>  
> A check would be nice (and I've asked about it before) but it's
> really not a lot of jumping through hoops since each connection has
> it's own "namespace" of prepared statements. Since they last until
> an explicit deallocate, the simple use of unique names makes it
> fairly easy on the application side.

Depends. I've got some report templating code that just replaces some 
parameters and executes sql embedded in the template.

Replacing the parameters is neater if I use prepare/execute, but if the 
sql gets executed again of course I get an error. The only way to know 
if there is a PREPARE is to regexp the sql text - yuck.

Now, you might argue I should make my report code handle prepare 
directly, then I'd know if I'd defined it or not. As it happens, that's 
not the way things stand though.

--   Richard Huxton  Archonet Ltd


pgsql-hackers by date:

Previous
From: "Thomas Hallgren"
Date:
Subject: Re: bug in GUC
Next
From: "Thomas Hallgren"
Date:
Subject: Re: bug in GUC