Re: JDBC with PG 8.4 bytea character escaping wire protocol

Поиск
Список
Период
Сортировка
От David Wall
Тема Re: JDBC with PG 8.4 bytea character escaping wire protocol
Дата
Msg-id 4AE0CADE.1000107@computer.org
обсуждение исходный текст
Ответ на Re: JDBC with PG 8.4 bytea character escaping wire protocol  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc

Does the JDBC 4 driver for PG 8.4 escape each character of the bytea type, or does it use a binary protocol?

When sending parameter data to the server, it uses the binary format.

When receiving results from the server, it uses the text format.

Thanks, Oliver.  Well, I hadn't even thought it could be both. <smile> 

There was confusion in the other replies because they were looking at how the data moves from my code into the driver, but not how the driver communicates with the backend.  It was clear I could store binary data as I was doing that just fine, but the PG docs made it sound like much of my binary data would end up expanding because more than half of the range an octet may have requires escaping per http://www.postgresql.org/docs/8.4/static/datatype-binary.html:

Table 8-7. bytea Literal Escaped Octets

Decimal Octet ValueDescriptionEscaped Input RepresentationExampleOutput Representation
0zero octetE'\\000'SELECT E'\\000'::bytea;\000
39single quote'''' or E'\\047'SELECT E'\''::bytea;'
92backslashE'\\\\' or E'\\134'SELECT E'\\\\'::bytea;\\
0 to 31 and 127 to 255"non-printable" octetsE'\\xxx' (octal value)SELECT E'\\001'::bytea;\001

I am thinking this should not be a real issue for me since I will be using LOs for by big objects and BYTEAs for the smaller objects.

Thanks again,
David

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: JDBC with PG 8.4 bytea character escaping wire protocol
Следующее
От: taktos
Дата:
Сообщение: Re: commit and rollback don't throw exceptions when they should