Re: PostgreSQL gaps wrt to java, and jdbc

From: Kevin Wooten <kdubb(at)me(dot)com>
To: Dave Cramer <davecramer(at)gmail(dot)com>
Cc: hlinnaka(at)iki(dot)fi, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: PostgreSQL gaps wrt to java, and jdbc
Date: 2015-07-07 20:40:27
Message-ID: F234B97B-04AD-458F-8C5F-9CBE9B9023A2@me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


> On Jul 7, 2015, at 1:26 PM, Dave Cramer <davecramer(at)gmail(dot)com> wrote:
>
>
>
>
> On 7 July 2015 at 16:24, Heikki Linnakangas <hlinnaka(at)iki(dot)fi <mailto:hlinnaka(at)iki(dot)fi>> wrote:
> On 07/07/2015 11:04 PM, Kevin Wooten wrote:
> As far as “coercion" goes maybe a better term would be “deduction”.
> There are numerous cases where it would be great if we could send the
> server a “don’t care” type and just a binary format. Instead we
> have to specify a type and format together. Doing this causes issues
> in edge cases (e.g. strings coming back padded because we specified
> varchar but the column was text).
>
> Oh, are you talking about query parameters, sent from the client to the server? The type OID and format code are not actually sent in the same message - you give the OID in the Parse message and the format code in Bind. You don't have to specify the OID in the Parse if you don't want to, and the server will deduce the most sensible one from the query context. After the Parse, you can find out what the server deduced by sending a ParameterDescription message, and then form the appropriate binary representation for the deduced type, and send it with Bind. Am I missing something?
>
>
> I think Kevin was hoping the server would just "figure it out" without all the back and forth.
>
> Dave Cramer
>

Well I want both.

I want it to work as Heikki describes. We currently do exactly what you are saying but when we leave out the types for parameters that are in turn returned in the results that’s where the edge cases begin. It was a while ago that I spent literally weeks trying to figure out how to get these right, ultimately I had to settle on sending all the parameter types (I think). I really need to peruse the final code again to refresh my memory and get some concrete examples that I was having. What we have now works well but it’s not perfect.

Also, yes, I want the server to just “figure it out” and send my binary types. Done.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Markus KARG 2015-07-07 20:46:16 Re: PostgreSQL gaps wrt to java, and jdbc
Previous Message Heikki Linnakangas 2015-07-07 20:34:40 Re: PostgreSQL gaps wrt to java, and jdbc