Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCZfX-0006SO-3H for pgsql-jdbc@arkaria.postgresql.org; Tue, 07 Jul 2015 20:40:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZCZfW-0007tA-5R for pgsql-jdbc@arkaria.postgresql.org; Tue, 07 Jul 2015 20:40:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZCZfU-0007sy-TK for pgsql-jdbc@postgresql.org; Tue, 07 Jul 2015 20:40:40 +0000 Received: from st11p05im-asmtp001.me.com ([17.172.109.149]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZCZfN-0002dg-33 for pgsql-jdbc@postgresql.org; Tue, 07 Jul 2015 20:40:39 +0000 Received: from [192.168.100.2] (ip68-2-54-213.ph.ph.cox.net [68.2.54.213]) by st11p05im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NR400D5KXFF5D10@st11p05im-asmtp001.me.com> for pgsql-jdbc@postgresql.org; Tue, 07 Jul 2015 20:40:29 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-07-07_07:2015-07-07,2015-07-07,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412110000 definitions=main-1507070313 Content-type: multipart/alternative; boundary="Apple-Mail=_BE91D2B5-F85D-4C59-927A-ACF6BDC2C0BD" MIME-version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: PostgreSQL gaps wrt to java, and jdbc From: Kevin Wooten In-reply-to: Date: Tue, 07 Jul 2015 13:40:27 -0700 Cc: hlinnaka@iki.fi, List Message-id: References: <80FEC5E5-DD36-46F4-A510-31E08415FBB1@me.com> <559C2CA8.6000200@iki.fi> <652E425F-7564-43E5-A3E7-86EE00E6157A@me.com> <559C358B.1000601@iki.fi> To: Dave Cramer X-Mailer: Apple Mail (2.2070.6) X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org --Apple-Mail=_BE91D2B5-F85D-4C59-927A-ACF6BDC2C0BD Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 7, 2015, at 1:26 PM, Dave Cramer wrote: >=20 >=20 >=20 >=20 > On 7 July 2015 at 16:24, Heikki Linnakangas > wrote: > On 07/07/2015 11:04 PM, Kevin Wooten wrote: > As far as =E2=80=9Ccoercion" goes maybe a better term would be = =E2=80=9Cdeduction=E2=80=9D. > There are numerous cases where it would be great if we could send the > server a =E2=80=9Cdon=E2=80=99t care=E2=80=9D 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). >=20 > 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? >=20 >=20 > I think Kevin was hoping the server would just "figure it out" without = all the back and forth.=20 >=20 > Dave Cramer >=20 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=E2=80=99s 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=E2=80=99s not perfect. Also, yes, I want the server to just =E2=80=9Cfigure it out=E2=80=9D and = send my binary types. Done. --Apple-Mail=_BE91D2B5-F85D-4C59-927A-ACF6BDC2C0BD Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Jul 7, 2015, at 1:26 PM, Dave Cramer <davecramer@gmail.com> wrote:




On 7 July 2015 at = 16:24, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 07/07/2015 11:04 PM, = Kevin Wooten wrote:
As far as =E2=80=9Ccoercion" goes maybe a better term would be = =E2=80=9Cdeduction=E2=80=9D.
There are numerous cases where it would be great if we could send the
server a =E2=80=9Cdon=E2=80=99t care=E2=80=9D 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=E2=80=99s 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=E2=80=99s not = perfect.

Also, = yes, I want the server to just =E2=80=9Cfigure it out=E2=80=9D and send = my binary types. Done.


= --Apple-Mail=_BE91D2B5-F85D-4C59-927A-ACF6BDC2C0BD--