From: Gary Doades <gpd@gpdnet.co.uk>
To: pgsql-odbc@postgresql.org
Subject: Re: ODBC int2 parameters to pg function
Date: Sun, 14 Mar 2004 18:18:39 -0000
Message-ID: <4054A1FF.5016.4CA631D@localhost> (raw)
In-Reply-To: <23185.1079285409@sss.pgh.pa.us>
References: <40542DDC.31043.304B562@localhost>
I don't see how it would break anything. I the case where the driver is substituting
ODBC parameters it ought to substitute (bind) the datatype that you have asked for.
In the case of "Select a_func(?,?)". If the two parameters are timestamp and smallint,
then the ODBC bind function calls specify these datatypes. Currently the ODBC
driver calls the function with a timestamp and an int4 parameter, where it should call
it with a timestamp and an int2 parameter.
I have checked a few other datatypes and looked at the "mylog" output. It seems that
dates, timestamp, numeric, floats are all explicitly typecast by the ODBC driver to
make sure the pg function gets called correctly, but not int2.
I'm not suggesting that general SQL strings are scanned and typecasts inserted.
Where functions/statements are called with parameters and those parameters then
substitued (bound) at run-time then it should get the types right where it matters.
AFAICS it is only int2 types that are not typecast. All other datatypes (except string
and int4 which don't need it) are typecast explicitly by the driver before being passed
to the server.
Regards,
Gary.
On 14 Mar 2004 at 12:30, Tom Lane wrote:
> "Gary Doades" <gpd@gpdnet.co.uk> writes:
> > I can cast inside the function, this is my current solution. Given that
> > there is no implicit downcast wouldn't the best solution be to get the
> > ODBC driver do the cast on the function call?
>
> I think that would likely fix this example at the cost of breaking many
> others. Exactly what conditions would you have the ODBC driver cast to
> int2 under?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: gpd@gpdnet.co.uk
Subject: Re: ODBC int2 parameters to pg function
In-Reply-To: <4054A1FF.5016.4CA631D@localhost>
References: <40542DDC.31043.304B562@localhost> <4054A1FF.5016.4CA631D@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox