pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: John Lister <john.lister-ps@kickstone.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Array passing
Date: Wed, 08 Apr 2009 09:02:50 -0700
Message-ID: <49DCCAAA.3080604@ejurka.com> (raw)
In-Reply-To: <C4640F583F47456D893E9D5E32806580@squarepi.com>
References: <E20C873C7A4448C3AF0A68B421ADED62@squarepi.com>
	<491f66a50904070817o3af217d4odc32bdfd29b47789@mail.gmail.com>
	<49DBBF8D.2080806@kickstone.com>
	<Pine.BSO.4.64.0904072207470.17908@leary.csoft.net>
	<C4640F583F47456D893E9D5E32806580@squarepi.com>

John Lister wrote:
> I've applied the patch, but there seems to be a couple of issues.
> 
> To do binary transfer, it needs to do a describe before the bind so as 
> to get the returned field types. This seems to only be done when 
> ForceBinaryTransfer is set.
> 

My memory of what the patch does is a little fuzzy and I've only looked 
at the binary receive patch, but here's how I understood it.

The current driver execution does not bother retrieving the describe 
results before executing a query.  This means we don't know what types 
will be returned beforehand, so we don't know if we can support 
retrieving them in binary and must retrieve them as text.  This is done 
to avoid an extra network roundtrip for query execution.  What the patch 
does is to look at a prepared statement and see if we've already 
prepared it.  If we have, then we have the previous describe results and 
know what fields we can handle as binary.  So without 
ForceBinaryTransfer, binary will only kick in on the second execution 
(or perhaps prepareThreshold executions, I forget).  ForceBinaryTransfer 
is really a hack to test this which prepares a query twice to make this 
work, so don't be fooled by the first preparation and wait for the 
second one.

> Secondly when it does the describe, sendParse trashes the fields details 
> by setting them to null before the main query is executed.
> 

I'm not sure what you're referring to specifically.  sendParse certainly 
doesn't adjust any of the params that are passed in, and it doesn't 
touch anything if the query is already prepared.

> Did this patch use to work, i can't see how in its current form.
> 

It did work and I have no reason to believe that's changed.  Perhaps it 
just isn't working as you're expecting.  Perhaps you're trying it with 
arrays which it might not support?  I'd try getting it working with a 
plain int or two first.

Kris Jurka




view thread (13+ messages)  latest in thread

Message-ID: <49DCCAAA.3080604@ejurka.com>
Permalink:  ../49DCCAAA.3080604@ejurka.com/
Also on:    postgresql.org/message-id/49DCCAAA.3080604@ejurka.com

 · 

reply

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-jdbc@postgresql.org
  Cc: books@ejurka.com, john.lister-ps@kickstone.com
  Subject: Re: Array passing
  In-Reply-To: <49DCCAAA.3080604@ejurka.com>
  References: <E20C873C7A4448C3AF0A68B421ADED62@squarepi.com> <491f66a50904070817o3af217d4odc32bdfd29b47789@mail.gmail.com> <49DBBF8D.2080806@kickstone.com> <Pine.BSO.4.64.0904072207470.17908@leary.csoft.net> <C4640F583F47456D893E9D5E32806580@squarepi.com> <49DCCAAA.3080604@ejurka.com>

* 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