Re: Can PostgreSQL do data type automated casting in

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
Cc: Kris Jurka <books(at)ejurka(dot)com>, Tjioe Ai Xin <xinxincute(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Can PostgreSQL do data type automated casting in
Date: 2005-11-22 03:59:06
Message-ID: 6F909ADC-23ED-40CF-A2B5-41DE61606A26@fastcrypt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

The easier way to deal with this has already been discussed. Simply
bind String to the Oid.Unknown type, and let the server deal with it.

How about we make this a configuration parameter.

Dave
On 21-Nov-05, at 6:37 PM, Mark Lewis wrote:

> Here's a thought; do you think it's feasible to detect cases where the
> protocol=3 driver throws an error due to invalid or ambiguous typing
> issues when the protocol=2 driver would just do the expected thing?
>
> Instead of throwing the error back to the user, could the driver then
> issue a 'describe statement' call, use the result to disambiguate the
> parameter settings, and re-issue the call? It increases the overhead
> but only for the error cases, and the result could be cached to avoid
> repeating that overhead.
>
> I haven't done any hacking in the driver yet, so maybe it would be too
> much of a pain to implement to justify any possible gains.
>
> -- Mark Lewis
>
> On Mon, 2005-11-21 at 18:08 -0500, Kris Jurka wrote:
>>
>> On Mon, 21 Nov 2005, Tjioe Ai Xin wrote:
>>
>>>
>>> My code is like this: I have query: "Select count(*) / paramPage
>>> from
>>> tblFirst where condition"; The paramPage were filled from parameter
>>> which I specified as string data type. So I using setString
>>> method for
>>> my prepared statement for passing paramPage value. When I'm using
>>> the
>>> old jdbc driver pg74jdbc3.jar, I got no problem at all. But when
>>> I try
>>> to upgrade my PostgreSQL to 8.0.3. I got problem data type error.
>>>
>>> Can PostgreSQL do data type automated casting in prepared
>>> statement again?
>>> So I do not need change my code :)
>>>
>>
>> Yes, and no. You can restore the old behavior by adding
>> ?protocolVersion=2 to your connection URL, but using the older
>> protocol
>> also means some new features and performance gains will be
>> unavailable to
>> you.
>>
>> Kris Jurka
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 6: explain analyze is your friend
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-11-22 09:33:20 Re: Can PostgreSQL do data type automated casting in
Previous Message Mark Lewis 2005-11-22 00:48:02 Re: Can PostgreSQL do data type automated casting