Re: PostgreSQL gaps wrt to java, and jdbc

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: PostgreSQL gaps wrt to java, and jdbc
Дата
Msg-id 559C37E0.6070809@iki.fi
обсуждение исходный текст
Ответ на Re: PostgreSQL gaps wrt to java, and jdbc  (Dave Cramer <davecramer@gmail.com>)
Список pgsql-jdbc
On 07/07/2015 11:26 PM, Dave Cramer 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 “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.

Well, if you use the binary representation, you need to somehow tell the
server which datatype's binary representation you're using. Perhaps you
could tell the server "I'm sending this in the binary representation of
int4, but I still want you to deduce the actual type as if it was
unknown", but that raises the question: if you know it's an integer, why
do you want the server to do the deduction?

- Heikki



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

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