First of all "promised at OSCON to fix" is a bit exaggerated. I said I
will look into the issue and see what can be done.
Having done something similar for the SPI manager once, so that
parameters can have unknown type and the code calling SPI_prepare() will
find the chosen types in the type array, so that the code calling
SPI_execp() can do the appropriate type casting, my idea is that
preparing a statement does the same and exec prepared actually accepts
unknown type arguments and calls the typein function before running the
plan. However, I still need to look at the code ...
If this is doable that way, we could log it as an open issue that needs
to be finished for release.
Jan
On 8/3/2004 1:18 PM, Jonathan Gardner wrote:
> On Tuesday 03 August 2004 08:18 am, Tom Lane wrote:
>> "Greg Sabino Mullane" <greg@turnstep.com> writes:
>> > Second, Jan promised at OSCON to fix up server-side prepare so it
>> > actually works even if you do not have the exact types to pass in. I
>> > presume you will then be able to do something like this:
>> > PREPARE mystatement AS SELECT * FROM pg_class WHERE relanem = $1
>> > which will make driver writers very, very happy.
>>
>> Why would a driver writer care? He can use the Prepare protocol
>> message, which already can do the above --- and more to the point,
>> there's already a way for him to *find out* what types were resolved.
>> There is no way for the SQL-level PREPARE command to provide info
>> about how types were resolved, so I'm not in favor of hacking the
>> SQL command this way.
>>
>
> Quoth the manual (7.4):
> Presently, prepared statements for use with PQexecPrepared must be set up
> by executing an SQL PREPARE command, which is typically sent with PQexec
> (though any of libpq's query-submission functions may be used). A
> lower-level interface for preparing statements may be offered in a future
> release.
>
> Does the new, 8.0 libpq have an interface to the prepare protocol message?
>
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #