Re: PostgreSQL gaps wrt to java, and jdbc

Поиск
Список
Период
Сортировка
От Kevin Wooten
Тема Re: PostgreSQL gaps wrt to java, and jdbc
Дата
Msg-id 652E425F-7564-43E5-A3E7-86EE00E6157A@me.com
обсуждение исходный текст
Ответ на Re: PostgreSQL gaps wrt to java, and jdbc  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: PostgreSQL gaps wrt to java, and jdbc  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-jdbc
Although what you suggest might be useful.  For the ng driver we’ve handled that.  At startup we download every type
andmap them based on the send,recv,in,out. So we just specify them for each query. 

As far as “coercion" goes maybe a better term would be “deduction”.  There are numerous cases where it would be great
ifwe 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
columnwas text). 

Actually an easier solution specific to our implementation would be to simply tell the driver to always return results
inbinary when it’s available. It would cover most cases including removing the parse/bind step for many queries. 

> On Jul 7, 2015, at 12:46 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>
> On 07/07/2015 09:31 PM, Kevin Wooten wrote:
>> == Binary type coercion ==
>> The biggest impediment I’ve run into is the fact that PG will not
>> attempt coercion on binary types. If you specify a binary type in the
>> protocol, that’s the final word. A better system would be to have PG
>> perform the same coercion it does for text types and then send the
>> results back with coerced types, in binary; finally falling back to
>> text when binary cannot be produced. This would solve almost every
>> issue we have had to work around in the “ng” driver.
>
> Can you elaborate? I'm confused, because the server can produce binary output for any datatype that has binary output
functions.That covers all built-in datatypes and all extension datatypes people use in practice. 
>
> What I've imagined to be a problem, though, is that you have to either understand the binary representation of all
datatypesin the client, or you have to request binary for only those datatypes you can handle. And to know which
datatypea result set's column has, you have to Describe it before fetching the results, which adds an extra round-trip.
Soit would be handy if the driver could provide the server a list of datatypes that should be sent as binary, as a
one-timeoperation at the beginning of the session for example, rather than indicating for each column in each query
separately.
>
> - Heikki
>



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: PostgreSQL gaps wrt to java, and jdbc
Следующее
От: Kevin Wooten
Дата:
Сообщение: Re: PostgreSQL gaps wrt to java, and jdbc